<!DOCTYPE html>
<html lang="" xml:lang="">
<head>

  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title>3 Linux神器 | Linux学习</title>
  <meta name="description" content="3 Linux神器 | Linux学习" />
  <meta name="generator" content="bookdown 0.45 and GitBook 2.6.7" />

  <meta property="og:title" content="3 Linux神器 | Linux学习" />
  <meta property="og:type" content="book" />
  
  
  

  <meta name="twitter:card" content="summary" />
  <meta name="twitter:title" content="3 Linux神器 | Linux学习" />
  
  
  

<meta name="author" content="易生信" />
<meta name="author" content="www.bic.ac.cn/Training" />


<meta name="date" content="2025-10-31" />

  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  
  
<link rel="prev" href="softinstall.html"/>
<link rel="next" href="bash_string.html"/>
<script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/fuse.js@6.4.6/dist/fuse.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-clipboard.css" rel="stylesheet" />








<link href="libs/anchor-sections-1.1.0/anchor-sections.css" rel="stylesheet" />
<link href="libs/anchor-sections-1.1.0/anchor-sections-hash.css" rel="stylesheet" />
<script src="libs/anchor-sections-1.1.0/anchor-sections.js"></script>


<style type="text/css">
html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
  { counter-reset: source-line 0; }
pre.numberSource code > span
  { position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
  { content: counter(source-line);
    position: relative; left: -1em; text-align: right; vertical-align: baseline;
    border: none; display: inline-block;
    -webkit-touch-callout: none; -webkit-user-select: none;
    -khtml-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    padding: 0 4px; width: 4em;
    color: #aaaaaa;
  }
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
div.sourceCode
  {   }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>

<style type="text/css">
  
  div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
</style>

<link rel="stylesheet" href="style.css" type="text/css" />
</head>

<body>



  <div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">

    <div class="book-summary">
      <nav role="navigation">

<ul class="summary">
<li><a href="http://https://mp.weixin.qq.com/s/i71OMaUu6QtcY0pt1njHQA">Hello</a></li>

<li class="divider"></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i>前沿</a></li>
<li class="chapter" data-level="1" data-path="linux_basic.html"><a href="linux_basic.html"><i class="fa fa-check"></i><b>1</b> Linux初探，打开新世界的大门</a>
<ul>
<li class="chapter" data-level="1.1" data-path="linux_basic.html"><a href="linux_basic.html#basicDir"><i class="fa fa-check"></i><b>1.1</b> Linux系统简介和目录理解</a>
<ul>
<li class="chapter" data-level="1.1.1" data-path="linux_basic.html"><a href="linux_basic.html#why_linux"><i class="fa fa-check"></i><b>1.1.1</b> 为什么要用Linux系统</a></li>
<li class="chapter" data-level="1.1.2" data-path="linux_basic.html"><a href="linux_basic.html#linux_everywhere"><i class="fa fa-check"></i><b>1.1.2</b> Linux系统无处不在</a></li>
<li class="chapter" data-level="1.1.3" data-path="linux_basic.html"><a href="linux_basic.html#free_linux"><i class="fa fa-check"></i><b>1.1.3</b> 免费的Linux系统来一套</a></li>
<li class="chapter" data-level="1.1.4" data-path="linux_basic.html"><a href="linux_basic.html#linux_login"><i class="fa fa-check"></i><b>1.1.4</b> Linux系统登录-联系远方的她</a></li>
<li class="chapter" data-level="1.1.5" data-path="linux_basic.html"><a href="linux_basic.html#linux_cmd"><i class="fa fa-check"></i><b>1.1.5</b> 初识Linux系统 - 黑夜中的闪烁是你的落脚点</a></li>
<li class="chapter" data-level="1.1.6" data-path="linux_basic.html"><a href="linux_basic.html#my_computer"><i class="fa fa-check"></i><b>1.1.6</b> 我的电脑在哪？</a></li>
<li class="chapter" data-level="1.1.7" data-path="linux_basic.html"><a href="linux_basic.html#linux_system_hardware"><i class="fa fa-check"></i><b>1.1.7</b> 系统配置怎样？来看看256M硬盘的服务器</a></li>
<li class="chapter" data-level="1.1.8" data-path="linux_basic.html"><a href="linux_basic.html#directpry_show"><i class="fa fa-check"></i><b>1.1.8</b> 看下目录下都有什么</a></li>
<li class="chapter" data-level="1.1.9" data-path="linux_basic.html"><a href="linux_basic.html#mkdir"><i class="fa fa-check"></i><b>1.1.9</b> 新建一个目录</a></li>
<li class="chapter" data-level="1.1.10" data-path="linux_basic.html"><a href="linux_basic.html#cat_file"><i class="fa fa-check"></i><b>1.1.10</b> 访问文件</a></li>
<li class="chapter" data-level="1.1.11" data-path="linux_basic.html"><a href="linux_basic.html#com_parameter_help"><i class="fa fa-check"></i><b>1.1.11</b> 查看帮助，获取可用命令行参数</a></li>
<li class="chapter" data-level="1.1.12" data-path="linux_basic.html"><a href="linux_basic.html#first_summary"><i class="fa fa-check"></i><b>1.1.12</b> 小结</a></li>
<li class="chapter" data-level="1.1.13" data-path="linux_basic.html"><a href="linux_basic.html#first_exercise"><i class="fa fa-check"></i><b>1.1.13</b> 做个小测试</a></li>
</ul></li>
<li class="chapter" data-level="1.2" data-path="linux_basic.html"><a href="linux_basic.html#fileoperation"><i class="fa fa-check"></i><b>1.2</b> Linux下文件操作</a>
<ul>
<li class="chapter" data-level="1.2.1" data-path="linux_basic.html"><a href="linux_basic.html#tac_rev"><i class="fa fa-check"></i><b>1.2.1</b> 文件按行翻转和按列翻转</a></li>
<li class="chapter" data-level="1.2.2" data-path="linux_basic.html"><a href="linux_basic.html#new_file"><i class="fa fa-check"></i><b>1.2.2</b> 新建文件的n种方式</a></li>
<li class="chapter" data-level="1.2.3" data-path="linux_basic.html"><a href="linux_basic.html#file_cp_mv_rename_link"><i class="fa fa-check"></i><b>1.2.3</b> 文件拷贝、移动、重命名、软链</a></li>
<li class="chapter" data-level="1.2.4" data-path="linux_basic.html"><a href="linux_basic.html#linux_abnormal"><i class="fa fa-check"></i><b>1.2.4</b> Linux下命令的一些突发事故</a></li>
<li class="chapter" data-level="1.2.5" data-path="linux_basic.html"><a href="linux_basic.html#file_op_gzip_wc"><i class="fa fa-check"></i><b>1.2.5</b> 了解和操作你的文件</a></li>
<li class="chapter" data-level="1.2.6" data-path="linux_basic.html"><a href="linux_basic.html#second_exercise"><i class="fa fa-check"></i><b>1.2.6</b> 小结和练习</a></li>
</ul></li>
<li class="chapter" data-level="1.3" data-path="linux_basic.html"><a href="linux_basic.html#shortcut"><i class="fa fa-check"></i><b>1.3</b> Linux终端常用快捷操作</a></li>
<li class="chapter" data-level="1.4" data-path="linux_basic.html"><a href="linux_basic.html#linuxSpecialSymbols"><i class="fa fa-check"></i><b>1.4</b> Linux 命令中的特殊符号</a></li>
<li class="chapter" data-level="1.5" data-path="linux_basic.html"><a href="linux_basic.html#stdinoutpipe"><i class="fa fa-check"></i><b>1.5</b> Linux下的标准输入、输出、重定向、管道</a></li>
<li class="chapter" data-level="1.6" data-path="linux_basic.html"><a href="linux_basic.html#filecontent"><i class="fa fa-check"></i><b>1.6</b> Linux文件内容操作</a>
<ul>
<li class="chapter" data-level="1.6.1" data-path="linux_basic.html"><a href="linux_basic.html#generate_file_seq"><i class="fa fa-check"></i><b>1.6.1</b> 命令组合生成文件</a></li>
<li class="chapter" data-level="1.6.2" data-path="linux_basic.html"><a href="linux_basic.html#sort_par"><i class="fa fa-check"></i><b>1.6.2</b> 文件排序原来有暗仓</a></li>
<li class="chapter" data-level="1.6.3" data-path="linux_basic.html"><a href="linux_basic.html#%E5%AE%9E%E6%88%98fasta%E5%BA%8F%E5%88%97%E6%8F%90%E5%8F%96-fasta_extract"><i class="fa fa-check"></i><b>1.6.3</b> 实战FASTA序列提取 [#fasta_extract}</a></li>
</ul></li>
<li class="chapter" data-level="1.7" data-path="linux_basic.html"><a href="linux_basic.html#linux_search"><i class="fa fa-check"></i><b>1.7</b> Linux下的查找命令 - 文件哪里跑</a>
<ul>
<li class="chapter" data-level="1.7.1" data-path="linux_basic.html"><a href="linux_basic.html#seach_cmmand"><i class="fa fa-check"></i><b>1.7.1</b> 命令/可执行程序查找 - 定位脚本的位置</a></li>
<li class="chapter" data-level="1.7.2" data-path="linux_basic.html"><a href="linux_basic.html#locate"><i class="fa fa-check"></i><b>1.7.2</b> locate普通文件快速定位</a></li>
<li class="chapter" data-level="1.7.3" data-path="linux_basic.html"><a href="linux_basic.html#find"><i class="fa fa-check"></i><b>1.7.3</b> find让文件无处可逃 find</a></li>
<li class="chapter" data-level="1.7.4" data-path="linux_basic.html"><a href="linux_basic.html#grep_file"><i class="fa fa-check"></i><b>1.7.4</b> 按文件内容查找 grep</a></li>
</ul></li>
<li class="chapter" data-level="1.8" data-path="linux_basic.html"><a href="linux_basic.html#grep_faster"><i class="fa fa-check"></i><b>1.8</b> 一句话加速grep近30倍</a>
<ul>
<li class="chapter" data-level="1.8.1" data-path="linux_basic.html"><a href="linux_basic.html#grep_single_gene"><i class="fa fa-check"></i><b>1.8.1</b> 获取单基因表达量</a></li>
<li class="chapter" data-level="1.8.2" data-path="linux_basic.html"><a href="linux_basic.html#grep_multiple_gene"><i class="fa fa-check"></i><b>1.8.2</b> 那如果获取多个基因怎么操作呢？</a></li>
</ul></li>
<li class="chapter" data-level="1.9" data-path="linux_basic.html"><a href="linux_basic.html#linux%E4%B8%8B%E7%9A%84%E6%89%B9%E9%87%8F%E6%93%8D%E4%BD%9C"><i class="fa fa-check"></i><b>1.9</b> Linux下的批量操作</a></li>
<li class="chapter" data-level="1.10" data-path="linux_basic.html"><a href="linux_basic.html#top"><i class="fa fa-check"></i><b>1.10</b> 监控程序的运行时间和资源占用</a></li>
<li class="chapter" data-level="1.11" data-path="linux_basic.html"><a href="linux_basic.html#%E4%B8%8D%E5%90%8C%E7%B3%BB%E7%BB%9F%E7%9A%84%E6%8D%A2%E8%A1%8C%E7%AC%A6%E4%B8%8D%E5%85%BC%E5%AE%B9%E5%BC%95%E5%8F%91%E7%9A%84%E9%97%AE%E9%A2%98"><i class="fa fa-check"></i><b>1.11</b> 不同系统的换行符不兼容引发的问题</a>
<ul>
<li class="chapter" data-level="1.11.1" data-path="linux_basic.html"><a href="linux_basic.html#winddows-%E7%9A%84%E7%A8%8B%E5%BA%8F%E4%BC%A0%E5%88%B0-linux%E4%B8%8D%E8%83%BD%E8%BF%90%E8%A1%8C"><i class="fa fa-check"></i><b>1.11.1</b> Winddows 的程序传到 Linux不能运行</a></li>
<li class="chapter" data-level="1.11.2" data-path="linux_basic.html"><a href="linux_basic.html#winddows-%E7%9A%84%E6%95%B0%E6%8D%AE%E4%BC%A0%E5%88%B0-linux%E4%B8%8D%E8%83%BD%E5%8C%B9%E9%85%8D"><i class="fa fa-check"></i><b>1.11.2</b> Winddows 的数据传到 Linux不能匹配</a></li>
<li class="chapter" data-level="1.11.3" data-path="linux_basic.html"><a href="linux_basic.html#linux-%E7%9A%84%E6%95%B0%E6%8D%AE%E4%BC%A0%E5%88%B0-windows-%E6%89%93%E5%BC%80%E4%B8%8D%E6%8D%A2%E8%A1%8C"><i class="fa fa-check"></i><b>1.11.3</b> Linux 的数据传到 Windows 打开不换行</a></li>
</ul></li>
<li class="chapter" data-level="1.12" data-path="linux_basic.html"><a href="linux_basic.html#references"><i class="fa fa-check"></i><b>1.12</b> References</a></li>
</ul></li>
<li class="chapter" data-level="2" data-path="softinstall.html"><a href="softinstall.html"><i class="fa fa-check"></i><b>2</b> Linux下软件安装相关</a>
<ul>
<li class="chapter" data-level="2.1" data-path="softinstall.html"><a href="softinstall.html#fileattributeplusX"><i class="fa fa-check"></i><b>2.1</b> 文件属性和可执行属性</a>
<ul>
<li class="chapter" data-level="2.1.1" data-path="softinstall.html"><a href="softinstall.html#fileattribute"><i class="fa fa-check"></i><b>2.1.1</b> 文件属性</a></li>
<li class="chapter" data-level="2.1.2" data-path="softinstall.html"><a href="softinstall.html#executable"><i class="fa fa-check"></i><b>2.1.2</b> 可执行属性</a></li>
</ul></li>
<li class="chapter" data-level="2.2" data-path="softinstall.html"><a href="softinstall.html#PATH_path_which"><i class="fa fa-check"></i><b>2.2</b> PATH和path，傻傻分不清</a>
<ul>
<li class="chapter" data-level="2.2.1" data-path="softinstall.html"><a href="softinstall.html#last_but_not_least"><i class="fa fa-check"></i><b>2.2.1</b> 小事也不能忽略</a></li>
</ul></li>
<li class="chapter" data-level="2.3" data-path="softinstall.html"><a href="softinstall.html#softInstallways"><i class="fa fa-check"></i><b>2.3</b> 软件安装的几种传统方式</a>
<ul>
<li class="chapter" data-level="2.3.1" data-path="softinstall.html"><a href="softinstall.html#system_package"><i class="fa fa-check"></i><b>2.3.1</b> 系统包管理器安装</a></li>
<li class="chapter" data-level="2.3.2" data-path="softinstall.html"><a href="softinstall.html#binary"><i class="fa fa-check"></i><b>2.3.2</b> 下载二进制文件</a></li>
<li class="chapter" data-level="2.3.3" data-path="softinstall.html"><a href="softinstall.html#configure_make_install"><i class="fa fa-check"></i><b>2.3.3</b> 源码编译安装</a></li>
<li class="chapter" data-level="2.3.4" data-path="softinstall.html"><a href="softinstall.html#pythonpac"><i class="fa fa-check"></i><b>2.3.4</b> Python包的安装</a></li>
<li class="chapter" data-level="2.3.5" data-path="softinstall.html"><a href="softinstall.html#anaconda_fear"><i class="fa fa-check"></i><b>2.3.5</b> Anaconda的两个福利</a></li>
<li class="chapter" data-level="2.3.6" data-path="softinstall.html"><a href="softinstall.html#R_install"><i class="fa fa-check"></i><b>2.3.6</b> R和R包的安装</a></li>
<li class="chapter" data-level="2.3.7" data-path="softinstall.html"><a href="softinstall.html#perl_package"><i class="fa fa-check"></i><b>2.3.7</b> Perl包的安装</a></li>
</ul></li>
<li class="chapter" data-level="2.4" data-path="softinstall.html"><a href="softinstall.html#condaInstall"><i class="fa fa-check"></i><b>2.4</b> Conda安装配置生物信息软件</a>
<ul>
<li class="chapter" data-level="2.4.1" data-path="softinstall.html"><a href="softinstall.html#condaInstallConfig"><i class="fa fa-check"></i><b>2.4.1</b> Conda安装和配置</a></li>
<li class="chapter" data-level="2.4.2" data-path="softinstall.html"><a href="softinstall.html#conda_basic"><i class="fa fa-check"></i><b>2.4.2</b> Conda基本使用</a></li>
<li class="chapter" data-level="2.4.3" data-path="softinstall.html"><a href="softinstall.html#conda_channel"><i class="fa fa-check"></i><b>2.4.3</b> Conda的channel</a></li>
<li class="chapter" data-level="2.4.4" data-path="softinstall.html"><a href="softinstall.html#conda_environment"><i class="fa fa-check"></i><b>2.4.4</b> 创建不同的软件运行环境</a></li>
<li class="chapter" data-level="2.4.5" data-path="softinstall.html"><a href="softinstall.html#remove_conda"><i class="fa fa-check"></i><b>2.4.5</b> 移除某个conda环境</a></li>
<li class="chapter" data-level="2.4.6" data-path="softinstall.html"><a href="softinstall.html#conda-R"><i class="fa fa-check"></i><b>2.4.6</b> Conda配置R</a></li>
<li class="chapter" data-level="2.4.7" data-path="softinstall.html"><a href="softinstall.html#conda_simple"><i class="fa fa-check"></i><b>2.4.7</b> Conda环境简化运行</a></li>
<li class="chapter" data-level="2.4.8" data-path="softinstall.html"><a href="softinstall.html#conda_bak"><i class="fa fa-check"></i><b>2.4.8</b> Conda环境备份</a></li>
<li class="chapter" data-level="2.4.9" data-path="softinstall.html"><a href="softinstall.html#conda_import"><i class="fa fa-check"></i><b>2.4.9</b> Conda环境导出和导入</a></li>
<li class="chapter" data-level="2.4.10" data-path="softinstall.html"><a href="softinstall.html#cond_segment_fault"><i class="fa fa-check"></i><b>2.4.10</b> Conda软件安装 core dump error/Segment fault/段错误 怎么办</a></li>
<li class="chapter" data-level="2.4.11" data-path="softinstall.html"><a href="softinstall.html#conda_slow"><i class="fa fa-check"></i><b>2.4.11</b> Conda为什么越来越慢？</a></li>
<li class="chapter" data-level="2.4.12" data-path="softinstall.html"><a href="softinstall.html#conda_how_work"><i class="fa fa-check"></i><b>2.4.12</b> Conda是如何工作的</a></li>
<li class="chapter" data-level="2.4.13" data-path="softinstall.html"><a href="softinstall.html#cond_which_step_slow"><i class="fa fa-check"></i><b>2.4.13</b> Conda哪一步慢？</a></li>
<li class="chapter" data-level="2.4.14" data-path="softinstall.html"><a href="softinstall.html#cond_accelarate"><i class="fa fa-check"></i><b>2.4.14</b> 如何提速Conda</a></li>
<li class="chapter" data-level="2.4.15" data-path="softinstall.html"><a href="softinstall.html#conda_downlaod_fast"><i class="fa fa-check"></i><b>2.4.15</b> 下载提速</a></li>
<li class="chapter" data-level="2.4.16" data-path="softinstall.html"><a href="softinstall.html#conda_pack"><i class="fa fa-check"></i><b>2.4.16</b> 使用conda-pack直接从已经安装好的地方拷贝一份 (同一操作系统)</a></li>
</ul></li>
<li class="chapter" data-level="2.5" data-path="softinstall.html"><a href="softinstall.html#docker"><i class="fa fa-check"></i><b>2.5</b> Docker安装</a>
<ul>
<li class="chapter" data-level="2.5.1" data-path="softinstall.html"><a href="softinstall.html#docker_what"><i class="fa fa-check"></i><b>2.5.1</b> Docker能做什么</a></li>
<li class="chapter" data-level="2.5.2" data-path="softinstall.html"><a href="softinstall.html#docker_basic"><i class="fa fa-check"></i><b>2.5.2</b> Docker的几个基本概念</a></li>
<li class="chapter" data-level="2.5.3" data-path="softinstall.html"><a href="softinstall.html#docker_install"><i class="fa fa-check"></i><b>2.5.3</b> 安装和配置</a></li>
<li class="chapter" data-level="2.5.4" data-path="softinstall.html"><a href="softinstall.html#docker_priviledges"><i class="fa fa-check"></i><b>2.5.4</b> Docker用户权限</a></li>
<li class="chapter" data-level="2.5.5" data-path="softinstall.html"><a href="softinstall.html#docker_try"><i class="fa fa-check"></i><b>2.5.5</b> Docker试用</a></li>
<li class="chapter" data-level="2.5.6" data-path="softinstall.html"><a href="softinstall.html#docker_basic_operation"><i class="fa fa-check"></i><b>2.5.6</b> Docker系统基本操作</a></li>
<li class="chapter" data-level="2.5.7" data-path="softinstall.html"><a href="softinstall.html#Dockerfile"><i class="fa fa-check"></i><b>2.5.7</b> 使用Dockerfile自动构建镜像</a></li>
<li class="chapter" data-level="2.5.8" data-path="softinstall.html"><a href="softinstall.html#docker_single_process"><i class="fa fa-check"></i><b>2.5.8</b> Docker的特征</a></li>
<li class="chapter" data-level="2.5.9" data-path="softinstall.html"><a href="softinstall.html#docker_attention"><i class="fa fa-check"></i><b>2.5.9</b> Docker使用注意</a></li>
</ul></li>
<li class="chapter" data-level="2.6" data-path="softinstall.html"><a href="softinstall.html#makefile"><i class="fa fa-check"></i><b>2.6</b> Makefile知识</a>
<ul>
<li class="chapter" data-level="2.6.1" data-path="softinstall.html"><a href="softinstall.html#docker_ref"><i class="fa fa-check"></i><b>2.6.1</b> 参考</a></li>
</ul></li>
<li class="chapter" data-level="2.7" data-path="softinstall.html"><a href="softinstall.html#references-1"><i class="fa fa-check"></i><b>2.7</b> References</a></li>
</ul></li>
<li class="chapter" data-level="3" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html"><i class="fa fa-check"></i><b>3</b> Linux神器</a>
<ul>
<li class="chapter" data-level="3.1" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#regularExpr"><i class="fa fa-check"></i><b>3.1</b> 正则表达式替换文本随心所欲</a></li>
<li class="chapter" data-level="3.2" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#awk"><i class="fa fa-check"></i><b>3.2</b> awk-生信分析不可缺少</a>
<ul>
<li class="chapter" data-level="3.2.1" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#awk_explain"><i class="fa fa-check"></i><b>3.2.1</b> awk基本参数解释</a></li>
<li class="chapter" data-level="3.2.2" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#awk_common_op"><i class="fa fa-check"></i><b>3.2.2</b> awk基本常见操作</a></li>
<li class="chapter" data-level="3.2.3" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#awk_combine"><i class="fa fa-check"></i><b>3.2.3</b> awk糅合操作 - 命令组合体现魅力</a></li>
</ul></li>
<li class="chapter" data-level="3.3" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#sed"><i class="fa fa-check"></i><b>3.3</b> SED命令 - 文本替换舍我其谁</a>
<ul>
<li class="chapter" data-level="3.3.1" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#sed_basic"><i class="fa fa-check"></i><b>3.3.1</b> sed基本参数解释</a></li>
<li class="chapter" data-level="3.3.2" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#sed_common"><i class="fa fa-check"></i><b>3.3.2</b> 常见操作</a></li>
</ul></li>
<li class="chapter" data-level="3.4" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#vim"><i class="fa fa-check"></i><b>3.4</b> VIM的使用</a>
<ul>
<li class="chapter" data-level="3.4.1" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#vim_first"><i class="fa fa-check"></i><b>3.4.1</b> 初识VIM</a></li>
<li class="chapter" data-level="3.4.2" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#vim_re"><i class="fa fa-check"></i><b>3.4.2</b> VIM中使用正则表达式</a></li>
</ul></li>
<li class="chapter" data-level="3.5" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#rename_all"><i class="fa fa-check"></i><b>3.5</b> 有了这些，文件批量重命名还需要求助其它工具吗？</a>
<ul>
<li class="chapter" data-level="3.5.1" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#rename_simple"><i class="fa fa-check"></i><b>3.5.1</b> 简单重命名</a></li>
<li class="chapter" data-level="3.5.2" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#rename_complex"><i class="fa fa-check"></i><b>3.5.2</b> 复杂重命名</a></li>
</ul></li>
<li class="chapter" data-level="3.6" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#nohup"><i class="fa fa-check"></i><b>3.6</b> 耗时很长的程序忘加nohup就运行了怎么办？</a></li>
<li class="chapter" data-level="3.7" data-path="LinuxGreatTools.html"><a href="LinuxGreatTools.html#references-2"><i class="fa fa-check"></i><b>3.7</b> References</a></li>
</ul></li>
<li class="chapter" data-level="4" data-path="bash_string.html"><a href="bash_string.html"><i class="fa fa-check"></i><b>4</b> Bash 字符串处理</a>
<ul>
<li class="chapter" data-level="4.1" data-path="bash_string.html"><a href="bash_string.html#bash_specific"><i class="fa fa-check"></i><b>4.1</b> Bash特殊字符</a></li>
<li class="chapter" data-level="4.2" data-path="bash_string.html"><a href="bash_string.html#bash_variable"><i class="fa fa-check"></i><b>4.2</b> Bash变量</a></li>
<li class="chapter" data-level="4.3" data-path="bash_string.html"><a href="bash_string.html#bash_operator"><i class="fa fa-check"></i><b>4.3</b> Bash操作符</a></li>
<li class="chapter" data-level="4.4" data-path="bash_string.html"><a href="bash_string.html#bash_logic"><i class="fa fa-check"></i><b>4.4</b> Shell中条件和test命令</a></li>
<li class="chapter" data-level="4.5" data-path="bash_string.html"><a href="bash_string.html#bash_flow"><i class="fa fa-check"></i><b>4.5</b> Shell流控制</a></li>
<li class="chapter" data-level="4.6" data-path="bash_string.html"><a href="bash_string.html#bash_function"><i class="fa fa-check"></i><b>4.6</b> Shell函数</a></li>
<li class="chapter" data-level="4.7" data-path="bash_string.html"><a href="bash_string.html#bash_inputoutput"><i class="fa fa-check"></i><b>4.7</b> 输入输出</a></li>
<li class="chapter" data-level="4.8" data-path="bash_string.html"><a href="bash_string.html#command_parameter"><i class="fa fa-check"></i><b>4.8</b> 命令行处理 命令行处理命令</a></li>
<li class="chapter" data-level="4.9" data-path="bash_string.html"><a href="bash_string.html#process_monitor"><i class="fa fa-check"></i><b>4.9</b> 进程和作业控制</a></li>
</ul></li>
<li class="chapter" data-level="5" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html"><i class="fa fa-check"></i><b>5</b> Bioinfo tools</a>
<ul>
<li class="chapter" data-level="5.1" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#cas9"><i class="fa fa-check"></i><b>5.1</b> 寻找Cas9的同源基因并进行进化分析</a></li>
<li class="chapter" data-level="5.2" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#biomart_motif"><i class="fa fa-check"></i><b>5.2</b> 如何获取目标基因的转录因子（上）——biomart下载基因和motif位置信息</a>
<ul>
<li class="chapter" data-level="5.2.1" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#biomart_motif_1"><i class="fa fa-check"></i><b>5.2.1</b> 1. 文件准备</a></li>
<li class="chapter" data-level="5.2.2" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#biomart_motif_2"><i class="fa fa-check"></i><b>5.2.2</b> 2. 什么是bed文件？</a></li>
<li class="chapter" data-level="5.2.3" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#biomart_motif_3"><i class="fa fa-check"></i><b>5.2.3</b> 3. BioMart数据下载</a></li>
</ul></li>
<li class="chapter" data-level="5.3" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#biomart_motif_4"><i class="fa fa-check"></i><b>5.3</b> 如何获取目标基因的转录因子（下）——Linux命令获取目标基因TF</a>
<ul>
<li class="chapter" data-level="5.3.1" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#biomart_motif_5"><i class="fa fa-check"></i><b>5.3.1</b> 1. 基础回顾</a></li>
<li class="chapter" data-level="5.3.2" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#biomart_motif_6"><i class="fa fa-check"></i><b>5.3.2</b> 2. 文件格式处理</a></li>
<li class="chapter" data-level="5.3.3" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#biomart_motif_7"><i class="fa fa-check"></i><b>5.3.3</b> 3. 计算基因的启动子区</a></li>
<li class="chapter" data-level="5.3.4" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#biomart_motif_8"><i class="fa fa-check"></i><b>5.3.4</b> 4. 取两文件的交集</a></li>
<li class="chapter" data-level="5.3.5" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#biomart_motif_9"><i class="fa fa-check"></i><b>5.3.5</b> 5. 提取我们关注的基因</a></li>
<li class="chapter" data-level="5.3.6" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#biomart_motif_10"><i class="fa fa-check"></i><b>5.3.6</b> 重点总结</a></li>
</ul></li>
<li class="chapter" data-level="5.4" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#emboss"><i class="fa fa-check"></i><b>5.4</b> emboss的使用</a></li>
<li class="chapter" data-level="5.5" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#samtools_snp"><i class="fa fa-check"></i><b>5.5</b> 使用samtools计算SNP</a></li>
<li class="chapter" data-level="5.6" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#bedtools"><i class="fa fa-check"></i><b>5.6</b> Bedtools使用</a></li>
<li class="chapter" data-level="5.7" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#sra_tools"><i class="fa fa-check"></i><b>5.7</b> SRA toolkit使用</a></li>
<li class="chapter" data-level="5.8" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#bioinfo_pipeline"><i class="fa fa-check"></i><b>5.8</b> 生信流程开发</a></li>
<li class="chapter" data-level="5.9" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#rsync"><i class="fa fa-check"></i><b>5.9</b> 数据同步和备份</a>
<ul>
<li class="chapter" data-level="5.9.1" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#scp"><i class="fa fa-check"></i><b>5.9.1</b> 原创拷贝scp</a></li>
<li class="chapter" data-level="5.9.2" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#rsync1"><i class="fa fa-check"></i><b>5.9.2</b> 镜像备份和增量同步 rsync</a></li>
<li class="chapter" data-level="5.9.3" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#rdiff_backup"><i class="fa fa-check"></i><b>5.9.3</b> 增量备份，记录各个版本 rdiff-backup</a></li>
</ul></li>
<li class="chapter" data-level="5.10" data-path="bioinfo-tools.html"><a href="bioinfo-tools.html#references-3"><i class="fa fa-check"></i><b>5.10</b> References</a></li>
</ul></li>
<li class="chapter" data-level="6" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html"><i class="fa fa-check"></i><b>6</b> 生物信息中Linux命令练习</a>
<ul>
<li class="chapter" data-level="6.1" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#gtf_chr"><i class="fa fa-check"></i><b>6.1</b> 统计GTF文件中染色体数目？</a></li>
<li class="chapter" data-level="6.2" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#gtf_num_gene"><i class="fa fa-check"></i><b>6.2</b> 统计GTF文件中基因数目？</a></li>
<li class="chapter" data-level="6.3" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#gtf_exon_length"><i class="fa fa-check"></i><b>6.3</b> 计算GTF中外显子总长度？</a></li>
<li class="chapter" data-level="6.4" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#gtf_transcript_num"><i class="fa fa-check"></i><b>6.4</b> 计算GTF文件中基因所拥有的平均转录本数目</a></li>
<li class="chapter" data-level="6.5" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#fasta"><i class="fa fa-check"></i><b>6.5</b> 生成一个多行Fasta测试序列供后续运算 (也可使用我们前面提供的脚本生成)</a></li>
<li class="chapter" data-level="6.6" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#fasta_uppercase"><i class="fa fa-check"></i><b>6.6</b> <code>test.fa</code>中的序列全转成大写</a></li>
<li class="chapter" data-level="6.7" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#fasta_len"><i class="fa fa-check"></i><b>6.7</b> 计算多行FASTA文件<code>test.fa</code>中每条序列长度</a></li>
<li class="chapter" data-level="6.8" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#fasta_format"><i class="fa fa-check"></i><b>6.8</b> 多行FASTA转单行FASTA序列</a></li>
<li class="chapter" data-level="6.9" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#fasta_name"><i class="fa fa-check"></i><b>6.9</b> 取出单行FASTA文件中序列长度大于40的序列的名字</a></li>
<li class="chapter" data-level="6.10" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#id_extract"><i class="fa fa-check"></i><b>6.10</b> 分别用<code>awk</code>和<code>grep</code>从<code>test.fa</code>中提取给定ID对应的序列</a></li>
<li class="chapter" data-level="6.11" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#standard"><i class="fa fa-check"></i><b>6.11</b> 利用AWK对基因表达数据进行标准化</a></li>
<li class="chapter" data-level="6.12" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#skip_first_row"><i class="fa fa-check"></i><b>6.12</b> 写出3种写法，去掉上一题<code>test.expr</code>矩阵中的第一行？</a></li>
<li class="chapter" data-level="6.13" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#add_row"><i class="fa fa-check"></i><b>6.13</b> 分别用<code>awk</code>和<code>sed</code>给<code>test.expr</code>矩阵加上标题行？</a></li>
<li class="chapter" data-level="6.14" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#bam"><i class="fa fa-check"></i><b>6.14</b> 给定一个<code>BAM</code>文件，怎么计算有多少基因组区域被测到了？平均测序深度是多少？</a></li>
<li class="chapter" data-level="6.15" data-path="bioinfo_linux.html"><a href="bioinfo_linux.html#jaccard"><i class="fa fa-check"></i><b>6.15</b> 如何使用<code>bedtools</code>的其它工具或其它Linux命令实现<code>bedtools jaccard</code>子功能？</a></li>
</ul></li>
<li class="chapter" data-level="7" data-path="supplemental.html"><a href="supplemental.html"><i class="fa fa-check"></i><b>7</b> Supplemental</a></li>
<li class="chapter" data-level="8" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html"><i class="fa fa-check"></i><b>8</b> 生信教程文章集锦</a>
<ul>
<li class="chapter" data-level="8.1" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E7%94%9F%E4%BF%A1%E5%AE%9D%E5%85%B8"><i class="fa fa-check"></i><b>8.1</b> 生信宝典</a>
<ul>
<li class="chapter" data-level="8.1.1" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E7%B3%BB%E5%88%97%E6%95%99%E7%A8%8B"><i class="fa fa-check"></i><b>8.1.1</b> 系列教程</a></li>
<li class="chapter" data-level="8.1.2" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#ngs%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7%E8%AF%84%E4%BC%B0"><i class="fa fa-check"></i><b>8.1.2</b> NGS分析工具评估</a></li>
<li class="chapter" data-level="8.1.3" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E5%AE%8F%E5%9F%BA%E5%9B%A0%E7%BB%84%E6%95%99%E7%A8%8B"><i class="fa fa-check"></i><b>8.1.3</b> 宏基因组教程</a></li>
<li class="chapter" data-level="8.1.4" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E7%B3%BB%E5%88%97%E5%AE%A3%E4%BC%A0"><i class="fa fa-check"></i><b>8.1.4</b> 系列宣传</a></li>
<li class="chapter" data-level="8.1.5" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E7%94%9F%E4%BF%A1%E7%94%9F%E7%89%A9%E7%9F%A5%E8%AF%86"><i class="fa fa-check"></i><b>8.1.5</b> 生信生物知识</a></li>
<li class="chapter" data-level="8.1.6" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E6%96%87%E7%8C%AE%E7%B2%BE%E8%AF%BB"><i class="fa fa-check"></i><b>8.1.6</b> 文献精读</a></li>
<li class="chapter" data-level="8.1.7" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#linux"><i class="fa fa-check"></i><b>8.1.7</b> Linux</a></li>
<li class="chapter" data-level="8.1.8" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#circos%E7%B3%BB%E5%88%97"><i class="fa fa-check"></i><b>8.1.8</b> CIRCOS系列</a></li>
<li class="chapter" data-level="8.1.9" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#r%E7%BB%9F%E8%AE%A1%E5%92%8C%E4%BD%9C%E5%9B%BE"><i class="fa fa-check"></i><b>8.1.9</b> R统计和作图</a></li>
<li class="chapter" data-level="8.1.10" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E6%89%A9%E5%A2%9E%E5%AD%90%E4%B8%89%E6%AD%A5%E6%9B%B2"><i class="fa fa-check"></i><b>8.1.10</b> 扩增子三步曲</a></li>
<li class="chapter" data-level="8.1.11" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E5%AE%8F%E5%9F%BA%E5%9B%A0%E7%BB%84%E5%88%86%E6%9E%90%E4%B8%93%E9%A2%98"><i class="fa fa-check"></i><b>8.1.11</b> 宏基因组分析专题</a></li>
<li class="chapter" data-level="8.1.12" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#ngs%E5%9F%BA%E7%A1%80"><i class="fa fa-check"></i><b>8.1.12</b> NGS基础</a></li>
<li class="chapter" data-level="8.1.13" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E7%99%8C%E7%97%87%E6%95%B0%E6%8D%AE%E5%BA%93"><i class="fa fa-check"></i><b>8.1.13</b> 癌症数据库</a></li>
<li class="chapter" data-level="8.1.14" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#python"><i class="fa fa-check"></i><b>8.1.14</b> Python</a></li>
<li class="chapter" data-level="8.1.15" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#ngs%E8%BD%AF%E4%BB%B6"><i class="fa fa-check"></i><b>8.1.15</b> NGS软件</a></li>
<li class="chapter" data-level="8.1.16" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#cytoscape%E7%BD%91%E7%BB%9C%E5%9B%BE"><i class="fa fa-check"></i><b>8.1.16</b> Cytoscape网络图</a></li>
<li class="chapter" data-level="8.1.17" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E5%88%86%E5%AD%90%E5%AF%B9%E6%8E%A5"><i class="fa fa-check"></i><b>8.1.17</b> 分子对接</a></li>
<li class="chapter" data-level="8.1.18" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E7%94%9F%E4%BF%A1%E5%AE%9D%E5%85%B8%E4%B9%8B%E5%82%BB%E7%93%9C%E5%BC%8F"><i class="fa fa-check"></i><b>8.1.18</b> 生信宝典之傻瓜式</a></li>
<li class="chapter" data-level="8.1.19" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E7%94%9F%E4%BF%A1%E4%BA%BA%E5%86%99%E7%A8%8B%E5%BA%8F"><i class="fa fa-check"></i><b>8.1.19</b> 生信人写程序</a></li>
<li class="chapter" data-level="8.1.20" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E5%B0%8F%E6%8A%80%E5%B7%A7%E7%B3%BB%E5%88%97"><i class="fa fa-check"></i><b>8.1.20</b> 小技巧系列</a></li>
<li class="chapter" data-level="8.1.21" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E6%8B%9B%E8%81%98"><i class="fa fa-check"></i><b>8.1.21</b> 招聘</a></li>
</ul></li>
<li class="chapter" data-level="8.2" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E5%AE%8F%E5%9F%BA%E5%9B%A0%E7%BB%84"><i class="fa fa-check"></i><b>8.2</b> 宏基因组</a>
<ul>
<li class="chapter" data-level="8.2.1" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E7%B2%BE%E9%80%89%E6%96%87%E7%AB%A0%E6%8E%A8%E8%8D%90"><i class="fa fa-check"></i><b>8.2.1</b> 精选文章推荐</a></li>
<li class="chapter" data-level="8.2.2" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E5%9F%B9%E8%AE%AD%E4%BC%9A%E8%AE%AE%E5%BE%81%E7%A8%BF%E6%8B%9B%E8%81%98"><i class="fa fa-check"></i><b>8.2.2</b> 培训、会议、征稿、招聘</a></li>
<li class="chapter" data-level="8.2.3" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E7%A7%91%E7%A0%94%E7%BB%8F%E9%AA%8C"><i class="fa fa-check"></i><b>8.2.3</b> 科研经验</a></li>
<li class="chapter" data-level="8.2.4" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E8%BD%AF%E4%BB%B6%E5%92%8C%E6%95%B0%E6%8D%AE%E5%BA%93%E4%BD%BF%E7%94%A8"><i class="fa fa-check"></i><b>8.2.4</b> 软件和数据库使用</a></li>
<li class="chapter" data-level="8.2.5" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E6%89%A9%E5%A2%9E%E5%AD%90%E5%AD%A6%E4%B9%A0%E4%B8%89%E6%AD%A5%E6%9B%B2"><i class="fa fa-check"></i><b>8.2.5</b> 扩增子学习三步曲</a></li>
<li class="chapter" data-level="8.2.6" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E5%AE%8F%E5%9F%BA%E5%9B%A0%E7%BB%84%E5%88%86%E6%9E%90%E4%B8%93%E9%A2%98-1"><i class="fa fa-check"></i><b>8.2.6</b> 宏基因组分析专题</a></li>
<li class="chapter" data-level="8.2.7" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#r%E7%BB%9F%E8%AE%A1%E7%BB%98%E5%9B%BE"><i class="fa fa-check"></i><b>8.2.7</b> R统计绘图</a></li>
<li class="chapter" data-level="8.2.8" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E5%AE%9E%E9%AA%8C%E8%AE%BE%E8%AE%A1%E4%B8%8E%E6%8A%80%E6%9C%AF"><i class="fa fa-check"></i><b>8.2.8</b> 实验设计与技术</a></li>
<li class="chapter" data-level="8.2.9" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86"><i class="fa fa-check"></i><b>8.2.9</b> 基础知识</a></li>
<li class="chapter" data-level="8.2.10" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E5%BF%85%E8%AF%BB%E7%BB%BC%E8%BF%B0"><i class="fa fa-check"></i><b>8.2.10</b> 必读综述</a></li>
<li class="chapter" data-level="8.2.11" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E9%AB%98%E5%88%86%E6%96%87%E7%AB%A0%E5%A5%97%E8%B7%AF%E8%A7%A3%E8%AF%BB"><i class="fa fa-check"></i><b>8.2.11</b> 高分文章套路解读</a></li>
<li class="chapter" data-level="8.2.12" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E7%A7%91%E6%99%AE%E8%A7%86%E9%A2%91-%E5%AF%93%E6%95%99%E4%BA%8E%E4%B9%90"><i class="fa fa-check"></i><b>8.2.12</b> 科普视频-寓教于乐</a></li>
<li class="chapter" data-level="8.2.13" data-path="生信教程文章集锦.html"><a href="生信教程文章集锦.html#%E5%8F%8B%E5%86%9B%E6%96%87%E7%AB%A0%E6%B1%87%E6%80%BB%E6%8E%A8%E8%8D%90"><i class="fa fa-check"></i><b>8.2.13</b> 友军文章汇总推荐</a></li>
</ul></li>
</ul></li>
<li class="divider"></li>
<li><a href="mailto:chentong_biology@163.com" target="blank">chentong_biology@163.com</a></li>

</ul>

      </nav>
    </div>

    <div class="book-body">
      <div class="body-inner">
        <div class="book-header" role="navigation">
          <h1>
            <i class="fa fa-circle-o-notch fa-spin"></i><a href="./">Linux学习</a>
          </h1>
        </div>

        <div class="page-wrapper" tabindex="-1" role="main">
          <div class="page-inner">

            <section class="normal" id="section-">
<div id="LinuxGreatTools" class="section level1 hasAnchor" number="3">
<h1><span class="header-section-number">3</span> Linux神器<a href="LinuxGreatTools.html#LinuxGreatTools" class="anchor-section" aria-label="Anchor link to header"></a></h1>
<div id="regularExpr" class="section level2 hasAnchor" number="3.1">
<h2><span class="header-section-number">3.1</span> 正则表达式替换文本随心所欲<a href="LinuxGreatTools.html#regularExpr" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p>正则表达式 (regular expression)是用来做模糊匹配的，匹配符合特定模式的文本。最早来源于Unix系统中的<code>sed</code>和<code>grep</code>命令，在各个程序语言，如<code>perl</code>, <code>python</code>中也都有实现。不同程序语言中正则表达式语法大体通用，细节上又各自有自己的特色。</p>
<div class="figure" style="text-align: center"><span style="display:block;" id="fig:unnamed-chunk-72"></span>
<img src="http://www.bic.ac.cn/resource/pyre.png" alt="正则表达式基本语法" width="100%" />
<p class="caption">
Figure 3.1: 正则表达式基本语法
</p>
</div>
<div class="sourceCode" id="cb88"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb88-1"><a href="LinuxGreatTools.html#cb88-1" tabindex="-1"></a><span class="co"># 假如有这么一个测试文件</span></span>
<span id="cb88-2"><a href="LinuxGreatTools.html#cb88-2" tabindex="-1"></a><span class="ex">ct@ysx:</span> ~/$ cat <span class="op">&lt;&lt;END</span> <span class="op">&gt;</span>url.list</span>
<span id="cb88-3"><a href="LinuxGreatTools.html#cb88-3" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP</span></span>
<span id="cb88-4"><a href="LinuxGreatTools.html#cb88-4" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/Training</span></span>
<span id="cb88-5"><a href="LinuxGreatTools.html#cb88-5" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/Esx</span></span>
<span id="cb88-6"><a href="LinuxGreatTools.html#cb88-6" tabindex="-1"></a><span class="st">www.bic.ac.cn</span></span>
<span id="cb88-7"><a href="LinuxGreatTools.html#cb88-7" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Lineplot.html</span></span>
<span id="cb88-8"><a href="LinuxGreatTools.html#cb88-8" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/GOenrichmentplot.html</span></span>
<span id="cb88-9"><a href="LinuxGreatTools.html#cb88-9" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/PHeatmap.html</span></span>
<span id="cb88-10"><a href="LinuxGreatTools.html#cb88-10" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Boxplot.html</span></span>
<span id="cb88-11"><a href="LinuxGreatTools.html#cb88-11" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Barplot.html</span></span>
<span id="cb88-12"><a href="LinuxGreatTools.html#cb88-12" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Volcanoplot.html</span></span>
<span id="cb88-13"><a href="LinuxGreatTools.html#cb88-13" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Manhattanplot.html</span></span>
<span id="cb88-14"><a href="LinuxGreatTools.html#cb88-14" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Histogram.html</span></span>
<span id="cb88-15"><a href="LinuxGreatTools.html#cb88-15" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/VennDiagram.html</span></span>
<span id="cb88-16"><a href="LinuxGreatTools.html#cb88-16" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/UpsetView.html</span></span>
<span id="cb88-17"><a href="LinuxGreatTools.html#cb88-17" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Densityplot.html</span></span>
<span id="cb88-18"><a href="LinuxGreatTools.html#cb88-18" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/PCAplot.html</span></span>
<span id="cb88-19"><a href="LinuxGreatTools.html#cb88-19" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/PCoAplot.html</span></span>
<span id="cb88-20"><a href="LinuxGreatTools.html#cb88-20" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/CPCoAplot.html</span></span>
<span id="cb88-21"><a href="LinuxGreatTools.html#cb88-21" tabindex="-1"></a><span class="st">http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Sankey.html</span></span>
<span id="cb88-22"><a href="LinuxGreatTools.html#cb88-22" tabindex="-1"></a><span class="st">http://blog.genesino.com</span></span>
<span id="cb88-23"><a href="LinuxGreatTools.html#cb88-23" tabindex="-1"></a><span class="st">https://blog.csdn.net/qazplm12_3/</span></span>
<span id="cb88-24"><a href="LinuxGreatTools.html#cb88-24" tabindex="-1"></a><span class="st">https://blog.csdn.net/woodcorpse/</span></span>
<span id="cb88-25"><a href="LinuxGreatTools.html#cb88-25" tabindex="-1"></a><span class="st">blog.csdn.net/woodcorpse/article/details/79313846</span></span>
<span id="cb88-26"><a href="LinuxGreatTools.html#cb88-26" tabindex="-1"></a></span>
<span id="cb88-27"><a href="LinuxGreatTools.html#cb88-27" tabindex="-1"></a><span class="st">ImageGP is one of the Best online plot.</span></span>
<span id="cb88-28"><a href="LinuxGreatTools.html#cb88-28" tabindex="-1"></a><span class="st">123456789</span></span>
<span id="cb88-29"><a href="LinuxGreatTools.html#cb88-29" tabindex="-1"></a><span class="op">END</span></span></code></pre></div>
<p>获取以<code>https</code>开头的行</p>
<pre><code>ct@ysx: ~/$ grep &#39;^https&#39; url.list
https://blog.csdn.net/qazplm12_3/
https://blog.csdn.net/woodcorpse/</code></pre>
<p>获取包含数字的行</p>
<pre><code>ct@ysx:~/$ grep &#39;[0-9]&#39; url.list 
https://blog.csdn.net/qazplm12_3/
blog.csdn.net/woodcorpse/article/details/79313846
123456789</code></pre>
<p>获取空行</p>
<pre><code>ct@ysx:~/$ grep &#39;^$&#39; url.list 
</code></pre>
<p>获取<code>html</code>结尾的行</p>
<pre><code>ct@ysx:~/$ grep &#39;html$&#39; url.list 
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Lineplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/GOenrichmentplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/PHeatmap.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Boxplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Barplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Volcanoplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Manhattanplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Histogram.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/VennDiagram.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/UpsetView.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Densityplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/PCAplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/PCoAplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/CPCoAplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Sankey.html</code></pre>
<p>获取<code>Boxplot</code>和<code>Barplot</code>的地址</p>
<pre><code># 未能满足要求
ct@ysx:~/$ grep &#39;B.*plot&#39; url.list 
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Boxplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Barplot.html
ImageGP is one of the Best online plot.

# 一个办法：更长的匹配
ct@ysx:~/$ grep &#39;B.*plot.html&#39; url.list 
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Boxplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Barplot.html

# 限定中间不能有空格
ct@ysx:~/$ grep &#39;B[^ ]*plot&#39; url.list 
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Boxplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Barplot.html

# 限定中间只能有2个字符
ct@ysx:~/$ grep &#39;B..plot&#39; url.list 
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Boxplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Barplot.html

# 2个字符的另外一种写法
ct@ysx:~/$ grep -P &#39;B.{2}plot&#39; url.list 
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Boxplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Barplot.html

# 2个字符的再一种写法，只允许出现特定字符
ct@ysx:~/$ grep -P &#39;B[arox]*plot&#39; url.list 
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Boxplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/Barplot.html</code></pre>
<p>获取PCA或PCoA相关的行</p>
<pre><code>ct@ysx:~/$ grep &#39;PCo*A&#39; url.list 
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/PCAplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/PCoAplot.html
http://www.bic.ac.cn/ImageGP/index.php/Home/Index/CPCoAplot.html</code></pre>
</div>
<div id="awk" class="section level2 hasAnchor" number="3.2">
<h2><span class="header-section-number">3.2</span> awk-生信分析不可缺少<a href="LinuxGreatTools.html#awk" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p>前面的学习过程中已经提到了<code>awk</code>和<code>sed</code>的使用，作为一个引子。现在则详细列举关于<code>awk</code>常用的操作和一些偏门的操作。</p>
<div id="awk_explain" class="section level3 hasAnchor" number="3.2.1">
<h3><span class="header-section-number">3.2.1</span> awk基本参数解释<a href="LinuxGreatTools.html#awk_explain" class="anchor-section" aria-label="Anchor link to header"></a></h3>
<p>awk擅长于对文件按行操作，每次读取一行，然后进行相应的操作。</p>
<p>awk读取单个文件时的基本语法格式是<code>awk 'BEGIN{OFS=FS="\t"}{print $0, $1;}' filename</code>。</p>
<p>读取多个文件时的语法是<code>awk 'BEGIN{OFS=FS="\t"}ARGIND==1{print $0, $1;}ARGIND==2{print $0;}' file1 file2</code>。</p>
<p>awk后面的命令部分是用引号括起来的，可以单引号，可以双引号，但注意不能与内部命令中用到的引号相同，否则会导致最相邻的引号视为一组，引发解释错误。<strong>引号不可以嵌套</strong></p>
<ul>
<li><p><code>OFS</code>: 文件输出时的列分隔符 (output field separtor)</p></li>
<li><p><code>FS</code>: 文件输入时的列分隔符 (field separtor)</p></li>
<li><p><code>BEGIN</code>: 设置初始参数，初始化变量</p></li>
<li><p><code>END</code>: 读完文件后做最终的处理</p></li>
<li><p>其它<code>{}</code>：循环读取文件的每一行</p></li>
<li><p><code>$0</code>表示一行内容；<code>$1</code>, <code>$2</code>, … <code>$NF</code>表示第一列，第二列到最后一列。</p></li>
<li><p><code>NF (number of fields)</code>文件多少列；<code>NR (number of rows)</code> 文件读了多少行: <code>FNR</code> 当前文件读了多少行，常用于多文件操作时。</p></li>
<li><p><code>a[$1]=1</code>: 索引操作，类似于python中的字典，在<code>ID map</code>，<code>统计</code>中有很多应用。</p></li>
</ul>
</div>
<div id="awk_common_op" class="section level3 hasAnchor" number="3.2.2">
<h3><span class="header-section-number">3.2.2</span> awk基本常见操作<a href="LinuxGreatTools.html#awk_common_op" class="anchor-section" aria-label="Anchor link to header"></a></h3>
<ul>
<li>针对特定列的计算，比如wig文件的标准化</li>
</ul>
<div class="sourceCode" id="cb95"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb95-1"><a href="LinuxGreatTools.html#cb95-1" tabindex="-1"></a><span class="co"># 注意除了第一行是空格，其它行都是tab键分割</span></span>
<span id="cb95-2"><a href="LinuxGreatTools.html#cb95-2" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat <span class="op">&lt;&lt;END</span> <span class="op">&gt;</span>ysx.wig</span>
<span id="cb95-3"><a href="LinuxGreatTools.html#cb95-3" tabindex="-1"></a><span class="st">variableStep chrom=chr2</span></span>
<span id="cb95-4"><a href="LinuxGreatTools.html#cb95-4" tabindex="-1"></a><span class="st">300701  12</span></span>
<span id="cb95-5"><a href="LinuxGreatTools.html#cb95-5" tabindex="-1"></a><span class="st">300702  10</span></span>
<span id="cb95-6"><a href="LinuxGreatTools.html#cb95-6" tabindex="-1"></a><span class="st">300703  11</span></span>
<span id="cb95-7"><a href="LinuxGreatTools.html#cb95-7" tabindex="-1"></a><span class="st">300704  13</span></span>
<span id="cb95-8"><a href="LinuxGreatTools.html#cb95-8" tabindex="-1"></a><span class="st">300705  12.5</span></span>
<span id="cb95-9"><a href="LinuxGreatTools.html#cb95-9" tabindex="-1"></a><span class="op">END</span></span>
<span id="cb95-10"><a href="LinuxGreatTools.html#cb95-10" tabindex="-1"></a></span>
<span id="cb95-11"><a href="LinuxGreatTools.html#cb95-11" tabindex="-1"></a><span class="ex">ct@localhost:~/sxbd$</span> awk <span class="st">&#39;BEGIN{OFS=FS=&quot;\t&quot;}\</span></span>
<span id="cb95-12"><a href="LinuxGreatTools.html#cb95-12" tabindex="-1"></a><span class="st">    {if(FNR&gt;1) $2=$2*10^6/(2.5*10^6); print $0}&#39;</span> ysx.wig</span>
<span id="cb95-13"><a href="LinuxGreatTools.html#cb95-13" tabindex="-1"></a><span class="ex">variableStep</span> chrom=chr2</span>
<span id="cb95-14"><a href="LinuxGreatTools.html#cb95-14" tabindex="-1"></a><span class="ex">300701</span>  4.8</span>
<span id="cb95-15"><a href="LinuxGreatTools.html#cb95-15" tabindex="-1"></a><span class="ex">300702</span>  4</span>
<span id="cb95-16"><a href="LinuxGreatTools.html#cb95-16" tabindex="-1"></a><span class="ex">300703</span>  4.4</span>
<span id="cb95-17"><a href="LinuxGreatTools.html#cb95-17" tabindex="-1"></a><span class="ex">300704</span>  5.2</span>
<span id="cb95-18"><a href="LinuxGreatTools.html#cb95-18" tabindex="-1"></a><span class="ex">300705</span>  5</span></code></pre></div>
<ul>
<li>计算某列内容出现的次数。</li>
</ul>
<div class="sourceCode" id="cb96"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb96-1"><a href="LinuxGreatTools.html#cb96-1" tabindex="-1"></a><span class="co"># 怎么获得count文件，应该不难吧</span></span>
<span id="cb96-2"><a href="LinuxGreatTools.html#cb96-2" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat count </span>
<span id="cb96-3"><a href="LinuxGreatTools.html#cb96-3" tabindex="-1"></a><span class="ex">ID</span>  Type</span>
<span id="cb96-4"><a href="LinuxGreatTools.html#cb96-4" tabindex="-1"></a><span class="ex">Pou5f1</span>  Pluripotency</span>
<span id="cb96-5"><a href="LinuxGreatTools.html#cb96-5" tabindex="-1"></a><span class="ex">Nanog</span>   Pluripotency</span>
<span id="cb96-6"><a href="LinuxGreatTools.html#cb96-6" tabindex="-1"></a><span class="ex">Sox2</span>    Neuron</span>
<span id="cb96-7"><a href="LinuxGreatTools.html#cb96-7" tabindex="-1"></a><span class="ex">Tet1</span>    Epigenetic</span>
<span id="cb96-8"><a href="LinuxGreatTools.html#cb96-8" tabindex="-1"></a><span class="ex">Tet3</span>    Epigenetic</span>
<span id="cb96-9"><a href="LinuxGreatTools.html#cb96-9" tabindex="-1"></a><span class="ex">Myc</span> Oncogene</span>
<span id="cb96-10"><a href="LinuxGreatTools.html#cb96-10" tabindex="-1"></a></span>
<span id="cb96-11"><a href="LinuxGreatTools.html#cb96-11" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;BEGIN{OFS=FS=&quot;\t&quot;}{if(FNR&gt;1) a[$2]+=1;}END\</span></span>
<span id="cb96-12"><a href="LinuxGreatTools.html#cb96-12" tabindex="-1"></a><span class="st">    {print &quot;Type\tCount&quot;; for(i in a) print i,a[i];}&#39;</span> count</span>
<span id="cb96-13"><a href="LinuxGreatTools.html#cb96-13" tabindex="-1"></a><span class="ex">Type</span>    Count</span>
<span id="cb96-14"><a href="LinuxGreatTools.html#cb96-14" tabindex="-1"></a><span class="ex">Neuron</span>  1</span>
<span id="cb96-15"><a href="LinuxGreatTools.html#cb96-15" tabindex="-1"></a><span class="ex">Epigenetic</span>  2</span>
<span id="cb96-16"><a href="LinuxGreatTools.html#cb96-16" tabindex="-1"></a><span class="ex">Oncogene</span>    1</span>
<span id="cb96-17"><a href="LinuxGreatTools.html#cb96-17" tabindex="-1"></a><span class="ex">Pluripotency</span>    2</span>
<span id="cb96-18"><a href="LinuxGreatTools.html#cb96-18" tabindex="-1"></a></span>
<span id="cb96-19"><a href="LinuxGreatTools.html#cb96-19" tabindex="-1"></a><span class="co"># 这个也可以用下面方式代替，但不直接</span></span>
<span id="cb96-20"><a href="LinuxGreatTools.html#cb96-20" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> tail <span class="at">-n</span> +2 count <span class="kw">|</span> <span class="fu">cut</span> <span class="at">-f</span> 2 <span class="kw">|</span> <span class="fu">sort</span> <span class="kw">|</span> <span class="fu">uniq</span> <span class="at">-c</span> <span class="kw">|</span> <span class="dt">\</span></span>
<span id="cb96-21"><a href="LinuxGreatTools.html#cb96-21" tabindex="-1"></a>        <span class="fu">sed</span> <span class="at">-e</span> <span class="st">&#39;s/^  *//&#39;</span> <span class="at">-e</span> <span class="st">&#39;s/  */\t/&#39;</span> </span>
<span id="cb96-22"><a href="LinuxGreatTools.html#cb96-22" tabindex="-1"></a><span class="ex">2</span>   Epigenetic</span>
<span id="cb96-23"><a href="LinuxGreatTools.html#cb96-23" tabindex="-1"></a><span class="ex">1</span>   Neuron</span>
<span id="cb96-24"><a href="LinuxGreatTools.html#cb96-24" tabindex="-1"></a><span class="ex">1</span>   Oncogene</span>
<span id="cb96-25"><a href="LinuxGreatTools.html#cb96-25" tabindex="-1"></a><span class="ex">2</span>   Pluripotency</span></code></pre></div>
<ul>
<li>之前也提到过的<a href="http://mp.weixin.qq.com/s/rZ26i19hiS5ZOqIoqkL1Wg">列操作</a>，从GTF文件中提取启动子区域</li>
</ul>
<p>GRCh38.gtf可以从<a href="ftp://ftp.ensembl.org/pub/release-91/gtf/homo_sapiens/Homo_sapiens.GRCh38.91.gtf.gz" class="uri">ftp://ftp.ensembl.org/pub/release-91/gtf/homo_sapiens/Homo_sapiens.GRCh38.91.gtf.gz</a>下载，或使用提供的测试文件。</p>
<div class="sourceCode" id="cb97"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb97-1"><a href="LinuxGreatTools.html#cb97-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="st">&#39;s/&quot;/\t/g&#39;</span> GRCh38.gtf <span class="kw">|</span> <span class="dt">\</span></span>
<span id="cb97-2"><a href="LinuxGreatTools.html#cb97-2" tabindex="-1"></a>    <span class="fu">awk</span> <span class="st">&#39;BEGIN{OFS=FS=&quot;\t&quot;}{if($3==&quot;gene&quot;) {ensn=$10; symbol=$16; \</span></span>
<span id="cb97-3"><a href="LinuxGreatTools.html#cb97-3" tabindex="-1"></a><span class="st">        if($7==&quot;+&quot;) {start=$4-1; up=start-1000; if(up&lt;0) up=0; dw=start+500; \</span></span>
<span id="cb97-4"><a href="LinuxGreatTools.html#cb97-4" tabindex="-1"></a><span class="st">        print $1,up, dw, ensn, symbol, $7;} else \</span></span>
<span id="cb97-5"><a href="LinuxGreatTools.html#cb97-5" tabindex="-1"></a><span class="st">        if($7==&quot;-&quot;) {start=$5-1; up=start+1000; dw=start-500; \</span></span>
<span id="cb97-6"><a href="LinuxGreatTools.html#cb97-6" tabindex="-1"></a><span class="st">        if(dw&lt;0) dw=0; print $1,dw,up,ensn,symbol,$7}}}&#39;</span> <span class="kw">|</span> <span class="fu">sort</span> <span class="at">-k1,1</span> <span class="at">-k2,2n</span> <span class="dt">\</span></span>
<span id="cb97-7"><a href="LinuxGreatTools.html#cb97-7" tabindex="-1"></a>        <span class="op">&gt;</span>GRCh38.promoter.bed</span></code></pre></div>
<ul>
<li>数据矩阵的格式化输出</li>
</ul>
<div class="sourceCode" id="cb98"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb98-1"><a href="LinuxGreatTools.html#cb98-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat numeric.matrix </span>
<span id="cb98-2"><a href="LinuxGreatTools.html#cb98-2" tabindex="-1"></a><span class="ex">ID</span>  A   B   C</span>
<span id="cb98-3"><a href="LinuxGreatTools.html#cb98-3" tabindex="-1"></a><span class="ex">a</span>   1.002   1.234   1.999</span>
<span id="cb98-4"><a href="LinuxGreatTools.html#cb98-4" tabindex="-1"></a><span class="ex">b</span>   2.333   4.232   0.889</span>
<span id="cb98-5"><a href="LinuxGreatTools.html#cb98-5" tabindex="-1"></a></span>
<span id="cb98-6"><a href="LinuxGreatTools.html#cb98-6" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;{if(FNR==1) print $0; \</span></span>
<span id="cb98-7"><a href="LinuxGreatTools.html#cb98-7" tabindex="-1"></a><span class="st">    else {printf &quot;%s%s&quot;,$1,FS; for (i=2; i&lt;=NF; i++) \</span></span>
<span id="cb98-8"><a href="LinuxGreatTools.html#cb98-8" tabindex="-1"></a><span class="st">        printf &quot;%.1f %s&quot;, $i, (i==NF?RS:FS)}}&#39;</span> numeric.matrix </span>
<span id="cb98-9"><a href="LinuxGreatTools.html#cb98-9" tabindex="-1"></a><span class="ex">ID</span>  A   B   C</span>
<span id="cb98-10"><a href="LinuxGreatTools.html#cb98-10" tabindex="-1"></a><span class="ex">a</span> 1.0  1.2  2.0 </span>
<span id="cb98-11"><a href="LinuxGreatTools.html#cb98-11" tabindex="-1"></a><span class="ex">b</span> 2.3  4.2  0.9 </span></code></pre></div>
<ul>
<li>判断FASTQ文件中，输出质量值的长度是与序列长度不一致的序列ID</li>
</ul>
<div class="sourceCode" id="cb99"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb99-1"><a href="LinuxGreatTools.html#cb99-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat <span class="op">&lt;&lt;END</span> <span class="kw">|</span> <span class="fu">gzip</span> <span class="at">-c</span> <span class="op">&gt;</span>Test_2.fq.gz</span>
<span id="cb99-2"><a href="LinuxGreatTools.html#cb99-2" tabindex="-1"></a><span class="st">&gt;ysx1</span></span>
<span id="cb99-3"><a href="LinuxGreatTools.html#cb99-3" tabindex="-1"></a><span class="st">ACGTCGACGACGAGAGGAGAGGAGCCCTCTCGCCCGCCCTACTACCACCCACACACAACACAAGTGT</span></span>
<span id="cb99-4"><a href="LinuxGreatTools.html#cb99-4" tabindex="-1"></a><span class="st">+</span></span>
<span id="cb99-5"><a href="LinuxGreatTools.html#cb99-5" tabindex="-1"></a><span class="st">FFFFFFA</span><span class="va">$A</span><span class="st">#</span><span class="va">$$</span><span class="st">AFEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</span></span>
<span id="cb99-6"><a href="LinuxGreatTools.html#cb99-6" tabindex="-1"></a><span class="st">&gt;ysx2</span></span>
<span id="cb99-7"><a href="LinuxGreatTools.html#cb99-7" tabindex="-1"></a><span class="st">ACGTCGACGACGAGAGGAGAGGAGCCCTCTCGCCCGCCCTACTACCACCCACACACAACACAAGTGT</span></span>
<span id="cb99-8"><a href="LinuxGreatTools.html#cb99-8" tabindex="-1"></a><span class="st">+</span></span>
<span id="cb99-9"><a href="LinuxGreatTools.html#cb99-9" tabindex="-1"></a><span class="st">FFFFFF</span><span class="va">$A</span><span class="st">#</span><span class="va">$$</span><span class="st">AFEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</span></span>
<span id="cb99-10"><a href="LinuxGreatTools.html#cb99-10" tabindex="-1"></a><span class="st">&gt;ysx3</span></span>
<span id="cb99-11"><a href="LinuxGreatTools.html#cb99-11" tabindex="-1"></a><span class="st">ACGTCGACGACGAGAGGAGAGGAGCCTCTCGCCCGCCCTACTACCACCCACACACAACACAAGTGT</span></span>
<span id="cb99-12"><a href="LinuxGreatTools.html#cb99-12" tabindex="-1"></a><span class="st">+</span></span>
<span id="cb99-13"><a href="LinuxGreatTools.html#cb99-13" tabindex="-1"></a><span class="st">FFFFFFA</span><span class="va">$A</span><span class="st">#</span><span class="va">$$</span><span class="st">AFEEEEFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</span></span>
<span id="cb99-14"><a href="LinuxGreatTools.html#cb99-14" tabindex="-1"></a><span class="op">END</span></span></code></pre></div>
<div class="sourceCode" id="cb100"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb100-1"><a href="LinuxGreatTools.html#cb100-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> zcat Test_2.fq.gz <span class="kw">|</span> <span class="dt">\</span></span>
<span id="cb100-2"><a href="LinuxGreatTools.html#cb100-2" tabindex="-1"></a>    <span class="fu">awk</span> <span class="st">&#39;{if(FNR%4==1) ID=$0; else if(FNR%4==2) seq_len=length($0); \</span></span>
<span id="cb100-3"><a href="LinuxGreatTools.html#cb100-3" tabindex="-1"></a><span class="st">        else if(FNR%4==0) {quality_len=length($0); if(seq_len!=quality_len) print ID; }}&#39;</span> </span></code></pre></div>
<ul>
<li>筛选差异基因</li>
</ul>
<div class="sourceCode" id="cb101"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb101-1"><a href="LinuxGreatTools.html#cb101-1" tabindex="-1"></a><span class="co"># TAB键分割的文件</span></span>
<span id="cb101-2"><a href="LinuxGreatTools.html#cb101-2" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat de_gene</span>
<span id="cb101-3"><a href="LinuxGreatTools.html#cb101-3" tabindex="-1"></a><span class="ex">ID</span>  log2fc  padj</span>
<span id="cb101-4"><a href="LinuxGreatTools.html#cb101-4" tabindex="-1"></a><span class="ex">A</span>   1   0.001</span>
<span id="cb101-5"><a href="LinuxGreatTools.html#cb101-5" tabindex="-1"></a><span class="ex">B</span>   <span class="at">-1</span>  0.001</span>
<span id="cb101-6"><a href="LinuxGreatTools.html#cb101-6" tabindex="-1"></a><span class="ex">C</span>   1   0.001</span>
<span id="cb101-7"><a href="LinuxGreatTools.html#cb101-7" tabindex="-1"></a><span class="ex">D</span>   2   0.0001</span>
<span id="cb101-8"><a href="LinuxGreatTools.html#cb101-8" tabindex="-1"></a><span class="ex">E</span>   <span class="at">-0.51</span>   0.051</span>
<span id="cb101-9"><a href="LinuxGreatTools.html#cb101-9" tabindex="-1"></a><span class="ex">F</span>   0.1 0.1</span>
<span id="cb101-10"><a href="LinuxGreatTools.html#cb101-10" tabindex="-1"></a><span class="ex">G</span>   1   0.1</span>
<span id="cb101-11"><a href="LinuxGreatTools.html#cb101-11" tabindex="-1"></a></span>
<span id="cb101-12"><a href="LinuxGreatTools.html#cb101-12" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;$3&lt;0.05 || NR==1&#39;</span> de_gene </span>
<span id="cb101-13"><a href="LinuxGreatTools.html#cb101-13" tabindex="-1"></a><span class="ex">ID</span>  log2fc  padj</span>
<span id="cb101-14"><a href="LinuxGreatTools.html#cb101-14" tabindex="-1"></a><span class="ex">A</span>   1   0.001</span>
<span id="cb101-15"><a href="LinuxGreatTools.html#cb101-15" tabindex="-1"></a><span class="ex">B</span>   <span class="at">-1</span>  0.001</span>
<span id="cb101-16"><a href="LinuxGreatTools.html#cb101-16" tabindex="-1"></a><span class="ex">C</span>   1   0.001</span>
<span id="cb101-17"><a href="LinuxGreatTools.html#cb101-17" tabindex="-1"></a><span class="ex">D</span>   2   0.0001</span>
<span id="cb101-18"><a href="LinuxGreatTools.html#cb101-18" tabindex="-1"></a></span>
<span id="cb101-19"><a href="LinuxGreatTools.html#cb101-19" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;BEGIN{OFS=FS=&quot;\t&quot;}{if(FNR==1) print $0; \</span></span>
<span id="cb101-20"><a href="LinuxGreatTools.html#cb101-20" tabindex="-1"></a><span class="st">    else {abs_log2fc=($2&lt;0?$2*(-1):$2);if(abs_log2fc&gt;=1 &amp;&amp; $3&lt;0.05) print $0;}}&#39;</span> de_gene </span>
<span id="cb101-21"><a href="LinuxGreatTools.html#cb101-21" tabindex="-1"></a><span class="ex">ID</span>  log2fc  padj</span>
<span id="cb101-22"><a href="LinuxGreatTools.html#cb101-22" tabindex="-1"></a><span class="ex">A</span>   1   0.001</span>
<span id="cb101-23"><a href="LinuxGreatTools.html#cb101-23" tabindex="-1"></a><span class="ex">B</span>   <span class="at">-1</span>  0.001</span>
<span id="cb101-24"><a href="LinuxGreatTools.html#cb101-24" tabindex="-1"></a><span class="ex">C</span>   1   0.001</span>
<span id="cb101-25"><a href="LinuxGreatTools.html#cb101-25" tabindex="-1"></a><span class="ex">D</span>   2   0.0001</span></code></pre></div>
<ul>
<li>筛选差异基因存储到不同的文件</li>
</ul>
<div class="sourceCode" id="cb102"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb102-1"><a href="LinuxGreatTools.html#cb102-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;BEGIN{OFS=FS=&quot;\t&quot;; up=&quot;up&quot;; dw=&quot;dw&quot;;}\</span></span>
<span id="cb102-2"><a href="LinuxGreatTools.html#cb102-2" tabindex="-1"></a><span class="st">    {if(FNR==1) {print $0 &gt;up; print $0 &gt;dw;} else \</span></span>
<span id="cb102-3"><a href="LinuxGreatTools.html#cb102-3" tabindex="-1"></a><span class="st">    if ($3&lt;0.05) {if ($2&gt;=1) print $0 &gt;up; else if($2&lt;=-1) print $0 &gt;dw;}}&#39;</span> de_gene </span>
<span id="cb102-4"><a href="LinuxGreatTools.html#cb102-4" tabindex="-1"></a></span>
<span id="cb102-5"><a href="LinuxGreatTools.html#cb102-5" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> head up dw</span>
<span id="cb102-6"><a href="LinuxGreatTools.html#cb102-6" tabindex="-1"></a><span class="ex">==</span><span class="op">&gt;</span> up <span class="op">&lt;</span>==</span>
<span id="cb102-7"><a href="LinuxGreatTools.html#cb102-7" tabindex="-1"></a><span class="ex">ID</span>  log2fc  padj</span>
<span id="cb102-8"><a href="LinuxGreatTools.html#cb102-8" tabindex="-1"></a><span class="ex">A</span>   1   0.001</span>
<span id="cb102-9"><a href="LinuxGreatTools.html#cb102-9" tabindex="-1"></a><span class="ex">C</span>   1   0.001</span>
<span id="cb102-10"><a href="LinuxGreatTools.html#cb102-10" tabindex="-1"></a><span class="ex">D</span>   2   0.0001</span>
<span id="cb102-11"><a href="LinuxGreatTools.html#cb102-11" tabindex="-1"></a></span>
<span id="cb102-12"><a href="LinuxGreatTools.html#cb102-12" tabindex="-1"></a><span class="ex">==</span><span class="op">&gt;</span> dw <span class="op">&lt;</span>==</span>
<span id="cb102-13"><a href="LinuxGreatTools.html#cb102-13" tabindex="-1"></a><span class="ex">ID</span>  log2fc  padj</span>
<span id="cb102-14"><a href="LinuxGreatTools.html#cb102-14" tabindex="-1"></a><span class="ex">B</span>   <span class="at">-1</span>  0.001</span></code></pre></div>
<ul>
<li>筛选差异基因存储到不同的文件(自动版)</li>
</ul>
<div class="sourceCode" id="cb103"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb103-1"><a href="LinuxGreatTools.html#cb103-1" tabindex="-1"></a><span class="fu">awk</span> <span class="st">&#39;BEGIN{OFS=FS=&quot;\t&quot;; up=ARGV[1]&quot;.up&quot;; dw=ARGV[1]&quot;.dw&quot;;}\</span></span>
<span id="cb103-2"><a href="LinuxGreatTools.html#cb103-2" tabindex="-1"></a><span class="st">    {if(FNR==1) {print $0 &gt;up; print $0 &gt;dw;} \</span></span>
<span id="cb103-3"><a href="LinuxGreatTools.html#cb103-3" tabindex="-1"></a><span class="st">    else if ($3&lt;=0.05) {if($2&lt;=-1) print $0 &gt;up; else if ($2&gt;=1) print $0 &gt;dw;}}&#39;</span> de_gene</span></code></pre></div>
<ul>
<li>ID map，常用于转换序列的ID、提取信息、合并信息等</li>
</ul>
<div class="sourceCode" id="cb104"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb104-1"><a href="LinuxGreatTools.html#cb104-1" tabindex="-1"></a><span class="co"># TAB键分割的文件</span></span>
<span id="cb104-2"><a href="LinuxGreatTools.html#cb104-2" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat id_map </span>
<span id="cb104-3"><a href="LinuxGreatTools.html#cb104-3" tabindex="-1"></a><span class="ex">ENSM</span>    Symbol  Entrez</span>
<span id="cb104-4"><a href="LinuxGreatTools.html#cb104-4" tabindex="-1"></a><span class="ex">ENSG00000280516</span> TMEM42  693149</span>
<span id="cb104-5"><a href="LinuxGreatTools.html#cb104-5" tabindex="-1"></a><span class="ex">ENSG00000281886</span> TGM4    7047</span>
<span id="cb104-6"><a href="LinuxGreatTools.html#cb104-6" tabindex="-1"></a><span class="ex">ENSG00000280873</span> DGKD    8527</span>
<span id="cb104-7"><a href="LinuxGreatTools.html#cb104-7" tabindex="-1"></a><span class="ex">ENSG00000281244</span> ADAMTS13    11093</span>
<span id="cb104-8"><a href="LinuxGreatTools.html#cb104-8" tabindex="-1"></a><span class="ex">ENSG00000280701</span> RP11-272D20.2   </span>
<span id="cb104-9"><a href="LinuxGreatTools.html#cb104-9" tabindex="-1"></a><span class="ex">ENSG00000280674</span> ZDHHC3  51304</span>
<span id="cb104-10"><a href="LinuxGreatTools.html#cb104-10" tabindex="-1"></a><span class="ex">ENSG00000281623</span> Y_RNA   </span>
<span id="cb104-11"><a href="LinuxGreatTools.html#cb104-11" tabindex="-1"></a><span class="ex">ENSG00000280479</span> CACFD1  11094</span>
<span id="cb104-12"><a href="LinuxGreatTools.html#cb104-12" tabindex="-1"></a><span class="ex">ENSG00000281165</span> SLC2A6  11182</span>
<span id="cb104-13"><a href="LinuxGreatTools.html#cb104-13" tabindex="-1"></a><span class="ex">ENSG00000281879</span> ABO 28</span>
<span id="cb104-14"><a href="LinuxGreatTools.html#cb104-14" tabindex="-1"></a><span class="ex">ENSG00000282873</span> BCL7A   605</span>
<span id="cb104-15"><a href="LinuxGreatTools.html#cb104-15" tabindex="-1"></a><span class="ex">ENSG00000280651</span> AC156455.1  100506691</span>
<span id="cb104-16"><a href="LinuxGreatTools.html#cb104-16" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> vim ensm</span>
<span id="cb104-17"><a href="LinuxGreatTools.html#cb104-17" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat ensm </span>
<span id="cb104-18"><a href="LinuxGreatTools.html#cb104-18" tabindex="-1"></a><span class="ex">ENSG00000281244</span></span>
<span id="cb104-19"><a href="LinuxGreatTools.html#cb104-19" tabindex="-1"></a><span class="ex">ENSG00000281165</span></span>
<span id="cb104-20"><a href="LinuxGreatTools.html#cb104-20" tabindex="-1"></a><span class="ex">ENSG00000282873</span></span>
<span id="cb104-21"><a href="LinuxGreatTools.html#cb104-21" tabindex="-1"></a></span>
<span id="cb104-22"><a href="LinuxGreatTools.html#cb104-22" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;BEGIN{OFS=FS=&quot;\t&quot;}ARGIND==1{if(FNR&gt;1) ensm2entrez[$1]=$3;}\</span></span>
<span id="cb104-23"><a href="LinuxGreatTools.html#cb104-23" tabindex="-1"></a><span class="st">        ARGIND==2{print ensm2entrez[$1];}&#39;</span> id_map ensm</span>
<span id="cb104-24"><a href="LinuxGreatTools.html#cb104-24" tabindex="-1"></a><span class="ex">11093</span></span>
<span id="cb104-25"><a href="LinuxGreatTools.html#cb104-25" tabindex="-1"></a><span class="ex">11182</span></span>
<span id="cb104-26"><a href="LinuxGreatTools.html#cb104-26" tabindex="-1"></a><span class="ex">605</span></span>
<span id="cb104-27"><a href="LinuxGreatTools.html#cb104-27" tabindex="-1"></a></span>
<span id="cb104-28"><a href="LinuxGreatTools.html#cb104-28" tabindex="-1"></a><span class="co"># 替代解决方案，注意 -w的使用，避免部分匹配。最稳妥的方式还是使用awk。</span></span>
<span id="cb104-29"><a href="LinuxGreatTools.html#cb104-29" tabindex="-1"></a></span>
<span id="cb104-30"><a href="LinuxGreatTools.html#cb104-30" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> grep <span class="at">-w</span> <span class="at">-f</span> ensm id_map <span class="kw">|</span> <span class="fu">cut</span> <span class="at">-f</span> 3</span>
<span id="cb104-31"><a href="LinuxGreatTools.html#cb104-31" tabindex="-1"></a><span class="ex">11093</span></span>
<span id="cb104-32"><a href="LinuxGreatTools.html#cb104-32" tabindex="-1"></a><span class="ex">11182</span></span>
<span id="cb104-33"><a href="LinuxGreatTools.html#cb104-33" tabindex="-1"></a><span class="ex">605</span></span></code></pre></div>
<ul>
<li>转换大小写, <code>toupper</code>, <code>tolower</code></li>
</ul>
<div class="sourceCode" id="cb105"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb105-1"><a href="LinuxGreatTools.html#cb105-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat symbol </span>
<span id="cb105-2"><a href="LinuxGreatTools.html#cb105-2" tabindex="-1"></a><span class="ex">Tgm4</span></span>
<span id="cb105-3"><a href="LinuxGreatTools.html#cb105-3" tabindex="-1"></a><span class="ex">Dgkd</span></span>
<span id="cb105-4"><a href="LinuxGreatTools.html#cb105-4" tabindex="-1"></a><span class="ex">Abo</span></span>
<span id="cb105-5"><a href="LinuxGreatTools.html#cb105-5" tabindex="-1"></a></span>
<span id="cb105-6"><a href="LinuxGreatTools.html#cb105-6" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;BEGIN{OFS=FS=&quot;\t&quot;}ARGIND==1{if(FNR&gt;1) ensm2entrez[$2]=$3;}\</span></span>
<span id="cb105-7"><a href="LinuxGreatTools.html#cb105-7" tabindex="-1"></a><span class="st">        ARGIND==2{print ensm2entrez[toupper($1)];}&#39;</span> id_map symbol </span>
<span id="cb105-8"><a href="LinuxGreatTools.html#cb105-8" tabindex="-1"></a><span class="ex">7047</span></span>
<span id="cb105-9"><a href="LinuxGreatTools.html#cb105-9" tabindex="-1"></a><span class="ex">8527</span></span>
<span id="cb105-10"><a href="LinuxGreatTools.html#cb105-10" tabindex="-1"></a><span class="ex">28</span></span></code></pre></div>
<ul>
<li>awk数值操作</li>
</ul>
<div class="sourceCode" id="cb106"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb106-1"><a href="LinuxGreatTools.html#cb106-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat <span class="op">&lt;&lt;END</span> <span class="op">&gt;</span>file</span>
<span id="cb106-2"><a href="LinuxGreatTools.html#cb106-2" tabindex="-1"></a><span class="st">2</span></span>
<span id="cb106-3"><a href="LinuxGreatTools.html#cb106-3" tabindex="-1"></a><span class="st">4</span></span>
<span id="cb106-4"><a href="LinuxGreatTools.html#cb106-4" tabindex="-1"></a><span class="st">3.1</span></span>
<span id="cb106-5"><a href="LinuxGreatTools.html#cb106-5" tabindex="-1"></a><span class="st">4.5</span></span>
<span id="cb106-6"><a href="LinuxGreatTools.html#cb106-6" tabindex="-1"></a><span class="st">5.4</span></span>
<span id="cb106-7"><a href="LinuxGreatTools.html#cb106-7" tabindex="-1"></a><span class="st">7.6</span></span>
<span id="cb106-8"><a href="LinuxGreatTools.html#cb106-8" tabindex="-1"></a><span class="st">8</span></span>
<span id="cb106-9"><a href="LinuxGreatTools.html#cb106-9" tabindex="-1"></a><span class="op">END</span></span>
<span id="cb106-10"><a href="LinuxGreatTools.html#cb106-10" tabindex="-1"></a></span>
<span id="cb106-11"><a href="LinuxGreatTools.html#cb106-11" tabindex="-1"></a><span class="co"># log2对数</span></span>
<span id="cb106-12"><a href="LinuxGreatTools.html#cb106-12" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;BEGIN{OFS=&quot;\t&quot;;FS=&quot;\t&quot;}{print log($0)/log(2)}&#39;</span> file</span>
<span id="cb106-13"><a href="LinuxGreatTools.html#cb106-13" tabindex="-1"></a></span>
<span id="cb106-14"><a href="LinuxGreatTools.html#cb106-14" tabindex="-1"></a><span class="co"># 取整,四舍五入</span></span>
<span id="cb106-15"><a href="LinuxGreatTools.html#cb106-15" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;BEGIN{OFS=&quot;\t&quot;;FS=&quot;\t&quot;}{print int($1+0.5);}&#39;</span> file</span></code></pre></div>
<ul>
<li>awk定义函数</li>
</ul>
<div class="sourceCode" id="cb107"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb107-1"><a href="LinuxGreatTools.html#cb107-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat <span class="op">&lt;&lt;END</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">&#39;s/  */\t/g&#39;</span><span class="op">&gt;</span>file</span>
<span id="cb107-2"><a href="LinuxGreatTools.html#cb107-2" tabindex="-1"></a><span class="st">1   2   3   4</span></span>
<span id="cb107-3"><a href="LinuxGreatTools.html#cb107-3" tabindex="-1"></a><span class="st">5   6   7   8</span></span>
<span id="cb107-4"><a href="LinuxGreatTools.html#cb107-4" tabindex="-1"></a><span class="st">9   10  11  12</span></span>
<span id="cb107-5"><a href="LinuxGreatTools.html#cb107-5" tabindex="-1"></a><span class="op">END</span></span></code></pre></div>
<div class="sourceCode" id="cb108"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb108-1"><a href="LinuxGreatTools.html#cb108-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;function abs(x){return ((x &lt; 0.0) ? -x : x)}BEGIN{OFS=&quot;\t&quot;;FS=&quot;\t&quot;}\</span></span>
<span id="cb108-2"><a href="LinuxGreatTools.html#cb108-2" tabindex="-1"></a><span class="st">    {pos[1]=$1;pos[2]=$2;pos[3]=$3;pos[4]=$4; len=asort(pos); \</span></span>
<span id="cb108-3"><a href="LinuxGreatTools.html#cb108-3" tabindex="-1"></a><span class="st">    for(i=len;i&gt;1;i--) print abs(pos[i]-pos[i-1]);}&#39;</span> file</span></code></pre></div>
<ul>
<li>字符串匹配</li>
</ul>
<div class="sourceCode" id="cb109"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb109-1"><a href="LinuxGreatTools.html#cb109-1" tabindex="-1"></a><span class="co"># TAB键分割的文件</span></span>
<span id="cb109-2"><a href="LinuxGreatTools.html#cb109-2" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat ens.bed</span>
<span id="cb109-3"><a href="LinuxGreatTools.html#cb109-3" tabindex="-1"></a><span class="ex">1</span>   100 105</span>
<span id="cb109-4"><a href="LinuxGreatTools.html#cb109-4" tabindex="-1"></a><span class="ex">2</span>   100 105</span>
<span id="cb109-5"><a href="LinuxGreatTools.html#cb109-5" tabindex="-1"></a><span class="ex">3</span>   100 105</span>
<span id="cb109-6"><a href="LinuxGreatTools.html#cb109-6" tabindex="-1"></a><span class="ex">Mt</span>  100 105</span>
<span id="cb109-7"><a href="LinuxGreatTools.html#cb109-7" tabindex="-1"></a><span class="ex">X</span>   100 105</span>
<span id="cb109-8"><a href="LinuxGreatTools.html#cb109-8" tabindex="-1"></a></span>
<span id="cb109-9"><a href="LinuxGreatTools.html#cb109-9" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;BEGIN{OFS=FS=&quot;\t&quot;}{if($1~/^[0-9XY]/) $1=&quot;chr&quot;$1; else \</span></span>
<span id="cb109-10"><a href="LinuxGreatTools.html#cb109-10" tabindex="-1"></a><span class="st">    if($1~/M.*/) gsub(/M.*/, &quot;chrM&quot;, $1); print $0}&#39;</span> ens.bed </span>
<span id="cb109-11"><a href="LinuxGreatTools.html#cb109-11" tabindex="-1"></a><span class="ex">chr1</span>    100 105</span>
<span id="cb109-12"><a href="LinuxGreatTools.html#cb109-12" tabindex="-1"></a><span class="ex">chr2</span>    100 105</span>
<span id="cb109-13"><a href="LinuxGreatTools.html#cb109-13" tabindex="-1"></a><span class="ex">chr3</span>    100 105</span>
<span id="cb109-14"><a href="LinuxGreatTools.html#cb109-14" tabindex="-1"></a><span class="ex">chrM</span>    100 105</span>
<span id="cb109-15"><a href="LinuxGreatTools.html#cb109-15" tabindex="-1"></a><span class="ex">chrX</span>    100 105</span></code></pre></div>
<ul>
<li>字符串分割</li>
</ul>
<div class="sourceCode" id="cb110"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb110-1"><a href="LinuxGreatTools.html#cb110-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat trinity_id</span>
<span id="cb110-2"><a href="LinuxGreatTools.html#cb110-2" tabindex="-1"></a><span class="ex">Trinity_C1_g1_i1</span></span>
<span id="cb110-3"><a href="LinuxGreatTools.html#cb110-3" tabindex="-1"></a><span class="ex">Trinity_C1_g1_i2</span></span>
<span id="cb110-4"><a href="LinuxGreatTools.html#cb110-4" tabindex="-1"></a><span class="ex">Trinity_C1_g1_i3</span></span>
<span id="cb110-5"><a href="LinuxGreatTools.html#cb110-5" tabindex="-1"></a><span class="ex">Trinity_C2_g1_i1</span></span>
<span id="cb110-6"><a href="LinuxGreatTools.html#cb110-6" tabindex="-1"></a><span class="ex">Trinity_C3_g1_i1</span></span>
<span id="cb110-7"><a href="LinuxGreatTools.html#cb110-7" tabindex="-1"></a><span class="ex">Trinity_C3_g3_i2</span></span>
<span id="cb110-8"><a href="LinuxGreatTools.html#cb110-8" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;BEGIN{OFS=FS=&quot;\t&quot;}{count=split($1, geneL, &quot;_&quot;); gene=geneL[1]; \</span></span>
<span id="cb110-9"><a href="LinuxGreatTools.html#cb110-9" tabindex="-1"></a><span class="st">    for(i=2;i&lt;count;i++) gene=gene&quot;_&quot;geneL[i]; print gene,$1;}&#39;</span> trinity_id </span>
<span id="cb110-10"><a href="LinuxGreatTools.html#cb110-10" tabindex="-1"></a><span class="ex">Trinity_C1_g1</span>   Trinity_C1_g1_i1</span>
<span id="cb110-11"><a href="LinuxGreatTools.html#cb110-11" tabindex="-1"></a><span class="ex">Trinity_C1_g1</span>   Trinity_C1_g1_i2</span>
<span id="cb110-12"><a href="LinuxGreatTools.html#cb110-12" tabindex="-1"></a><span class="ex">Trinity_C1_g1</span>   Trinity_C1_g1_i3</span>
<span id="cb110-13"><a href="LinuxGreatTools.html#cb110-13" tabindex="-1"></a><span class="ex">Trinity_C2_g1</span>   Trinity_C2_g1_i1</span>
<span id="cb110-14"><a href="LinuxGreatTools.html#cb110-14" tabindex="-1"></a><span class="ex">Trinity_C3_g1</span>   Trinity_C3_g1_i1</span>
<span id="cb110-15"><a href="LinuxGreatTools.html#cb110-15" tabindex="-1"></a><span class="ex">Trinity_C3_g3</span>   Trinity_C3_g3_i2</span></code></pre></div>
<ul>
<li>awk脚本</li>
</ul>
<div class="sourceCode" id="cb111"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb111-1"><a href="LinuxGreatTools.html#cb111-1" tabindex="-1"></a></span>
<span id="cb111-2"><a href="LinuxGreatTools.html#cb111-2" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat <span class="op">&lt;&lt;END</span> <span class="op">&gt;</span>grade.awk</span>
<span id="cb111-3"><a href="LinuxGreatTools.html#cb111-3" tabindex="-1"></a><span class="st">BEGIN{OFS=FS=&quot;</span><span class="dt">\t</span><span class="st">&quot;; up=ARGV[1]&quot;.up&quot;; dw=ARGV[1]&quot;.dw&quot;;}</span></span>
<span id="cb111-4"><a href="LinuxGreatTools.html#cb111-4" tabindex="-1"></a><span class="st">    {if(FNR==1) {print </span><span class="va">$0</span><span class="st"> &gt;up; print </span><span class="va">$0</span><span class="st"> &gt;dw;} </span></span>
<span id="cb111-5"><a href="LinuxGreatTools.html#cb111-5" tabindex="-1"></a><span class="st">                 else if (</span><span class="va">$3</span><span class="st">&lt;=0.05) {</span></span>
<span id="cb111-6"><a href="LinuxGreatTools.html#cb111-6" tabindex="-1"></a><span class="st">                         if(</span><span class="va">$2</span><span class="st">&lt;=-1) print </span><span class="va">$0</span><span class="st"> &gt;up; </span></span>
<span id="cb111-7"><a href="LinuxGreatTools.html#cb111-7" tabindex="-1"></a><span class="st">                         else if (</span><span class="va">$2</span><span class="st">&gt;=1) print </span><span class="va">$0</span><span class="st"> &gt;dw;}</span></span>
<span id="cb111-8"><a href="LinuxGreatTools.html#cb111-8" tabindex="-1"></a><span class="st">    }</span></span>
<span id="cb111-9"><a href="LinuxGreatTools.html#cb111-9" tabindex="-1"></a><span class="op">END</span></span>
<span id="cb111-10"><a href="LinuxGreatTools.html#cb111-10" tabindex="-1"></a></span>
<span id="cb111-11"><a href="LinuxGreatTools.html#cb111-11" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="at">-f</span> grade.awk de_gene</span></code></pre></div>
<ul>
<li>awk给每行增加行号，使其变为唯一</li>
</ul>
<div class="sourceCode" id="cb112"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb112-1"><a href="LinuxGreatTools.html#cb112-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;BEGIN{OFS=&quot;\t&quot;;FS=&quot;\t&quot;}NR!=1{$4=$4&quot;_&quot;NR;print $0}&#39;</span> file</span></code></pre></div>
</div>
<div id="awk_combine" class="section level3 hasAnchor" number="3.2.3">
<h3><span class="header-section-number">3.2.3</span> awk糅合操作 - 命令组合体现魅力<a href="LinuxGreatTools.html#awk_combine" class="anchor-section" aria-label="Anchor link to header"></a></h3>
<ul>
<li>awk中执行系统命令 (注意引号的使用)</li>
</ul>
<div class="sourceCode" id="cb113"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb113-1"><a href="LinuxGreatTools.html#cb113-1" tabindex="-1"></a><span class="co"># input_mat</span></span>
<span id="cb113-2"><a href="LinuxGreatTools.html#cb113-2" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat <span class="op">&lt;&lt;END</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">&#39;s/  */\t/g&#39;</span> <span class="op">&gt;</span>input_mat</span>
<span id="cb113-3"><a href="LinuxGreatTools.html#cb113-3" tabindex="-1"></a><span class="st">SRR1    root</span></span>
<span id="cb113-4"><a href="LinuxGreatTools.html#cb113-4" tabindex="-1"></a><span class="st">SRR2    leaf</span></span>
<span id="cb113-5"><a href="LinuxGreatTools.html#cb113-5" tabindex="-1"></a><span class="st">SRR3    stem</span></span>
<span id="cb113-6"><a href="LinuxGreatTools.html#cb113-6" tabindex="-1"></a><span class="op">END</span></span>
<span id="cb113-7"><a href="LinuxGreatTools.html#cb113-7" tabindex="-1"></a></span>
<span id="cb113-8"><a href="LinuxGreatTools.html#cb113-8" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> touch SRR1.fq SRR2.fq SRR3.fq</span>
<span id="cb113-9"><a href="LinuxGreatTools.html#cb113-9" tabindex="-1"></a></span>
<span id="cb113-10"><a href="LinuxGreatTools.html#cb113-10" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> ls</span>
<span id="cb113-11"><a href="LinuxGreatTools.html#cb113-11" tabindex="-1"></a><span class="ex">SRR1.fq</span> SRR2.fq SRR3.fq </span>
<span id="cb113-12"><a href="LinuxGreatTools.html#cb113-12" tabindex="-1"></a></span>
<span id="cb113-13"><a href="LinuxGreatTools.html#cb113-13" tabindex="-1"></a><span class="co"># 系统命令组成字符串，交给system函数运行</span></span>
<span id="cb113-14"><a href="LinuxGreatTools.html#cb113-14" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> awk <span class="st">&#39;BEGIN{OFS=FS=&quot;\t&quot;}{system(&quot;mv &quot;$1&quot;.fq &quot;$2&quot;.fq&quot;);}&#39;</span> input_mat</span>
<span id="cb113-15"><a href="LinuxGreatTools.html#cb113-15" tabindex="-1"></a></span>
<span id="cb113-16"><a href="LinuxGreatTools.html#cb113-16" tabindex="-1"></a><span class="co"># </span></span>
<span id="cb113-17"><a href="LinuxGreatTools.html#cb113-17" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> ls</span>
<span id="cb113-18"><a href="LinuxGreatTools.html#cb113-18" tabindex="-1"></a><span class="ex">leaf.fq</span> root.fq stem.fq</span></code></pre></div>
<ul>
<li>awk 引用系统变量</li>
</ul>
<div class="sourceCode" id="cb114"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb114-1"><a href="LinuxGreatTools.html#cb114-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> echo 1 <span class="kw">|</span> <span class="fu">awk</span> <span class="at">-v</span> ysx=<span class="st">&quot;shengxinbaodian&quot;</span> <span class="dt">\</span></span>
<span id="cb114-2"><a href="LinuxGreatTools.html#cb114-2" tabindex="-1"></a>                        <span class="at">-v</span> ysx2=<span class="st">&quot;sxbd&quot;</span> <span class="st">&#39;{print ysx, ysx2;}&#39;</span></span>
<span id="cb114-3"><a href="LinuxGreatTools.html#cb114-3" tabindex="-1"></a><span class="ex">shengxinbaodian</span> sxbd</span></code></pre></div>
</div>
</div>
<div id="sed" class="section level2 hasAnchor" number="3.3">
<h2><span class="header-section-number">3.3</span> SED命令 - 文本替换舍我其谁<a href="LinuxGreatTools.html#sed" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<div id="sed_basic" class="section level3 hasAnchor" number="3.3.1">
<h3><span class="header-section-number">3.3.1</span> sed基本参数解释<a href="LinuxGreatTools.html#sed_basic" class="anchor-section" aria-label="Anchor link to header"></a></h3>
<p>sed是<code>stream editor</code>的简称，擅长对文件进行各种正则操作、插入操作、替换操作和删除操作，可以全局，可以指定特定范围的行或者特定特征的行。</p>
<p><code>s/pat/replace/</code>: 正则替换</p>
<p>前插行<code>i</code>, 后插行<code>a</code>, 替换行<code>c</code>, 删除行<code>d</code>, 输出行<code>p</code></p>
<p><code>N</code>: 读入下一行，同时存储；<code>n</code>:读入下一行，抛弃当前行</p>
</div>
<div id="sed_common" class="section level3 hasAnchor" number="3.3.2">
<h3><span class="header-section-number">3.3.2</span> 常见操作<a href="LinuxGreatTools.html#sed_common" class="anchor-section" aria-label="Anchor link to header"></a></h3>
<ul>
<li>替换特定的文本</li>
</ul>
<div class="sourceCode" id="cb115"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb115-1"><a href="LinuxGreatTools.html#cb115-1" tabindex="-1"></a><span class="co"># 空格是我们不太喜欢出现在文件中的一个符号，尤其是作为列名字时</span></span>
<span id="cb115-2"><a href="LinuxGreatTools.html#cb115-2" tabindex="-1"></a><span class="co"># 列使用TAB键分割</span></span>
<span id="cb115-3"><a href="LinuxGreatTools.html#cb115-3" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat <span class="op">&lt;&lt;END</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">&#39;s/;/\t/g&#39;</span> mat</span>
<span id="cb115-4"><a href="LinuxGreatTools.html#cb115-4" tabindex="-1"></a><span class="st">ID;2 cell;4 cell;8 cell;embryo</span></span>
<span id="cb115-5"><a href="LinuxGreatTools.html#cb115-5" tabindex="-1"></a><span class="st">Pou5f1_1;2;3;4;5</span></span>
<span id="cb115-6"><a href="LinuxGreatTools.html#cb115-6" tabindex="-1"></a><span class="st">Nanog_1;2;3.2;4.3;5</span></span>
<span id="cb115-7"><a href="LinuxGreatTools.html#cb115-7" tabindex="-1"></a><span class="st">c-Myc;2;3;4;5</span></span>
<span id="cb115-8"><a href="LinuxGreatTools.html#cb115-8" tabindex="-1"></a><span class="st">Tet1_3;2;3;4;5</span></span>
<span id="cb115-9"><a href="LinuxGreatTools.html#cb115-9" tabindex="-1"></a><span class="op">END</span></span>
<span id="cb115-10"><a href="LinuxGreatTools.html#cb115-10" tabindex="-1"></a></span>
<span id="cb115-11"><a href="LinuxGreatTools.html#cb115-11" tabindex="-1"></a><span class="co"># 一次替换</span></span>
<span id="cb115-12"><a href="LinuxGreatTools.html#cb115-12" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="st">&#39;s/ /_/&#39;</span> mat </span>
<span id="cb115-13"><a href="LinuxGreatTools.html#cb115-13" tabindex="-1"></a><span class="ex">ID</span>  2_cell  4 cell  8 cell  embryo</span>
<span id="cb115-14"><a href="LinuxGreatTools.html#cb115-14" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb115-15"><a href="LinuxGreatTools.html#cb115-15" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb115-16"><a href="LinuxGreatTools.html#cb115-16" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb115-17"><a href="LinuxGreatTools.html#cb115-17" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span>
<span id="cb115-18"><a href="LinuxGreatTools.html#cb115-18" tabindex="-1"></a></span>
<span id="cb115-19"><a href="LinuxGreatTools.html#cb115-19" tabindex="-1"></a><span class="co"># 全部替换</span></span>
<span id="cb115-20"><a href="LinuxGreatTools.html#cb115-20" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="st">&#39;s/ /_/g&#39;</span> mat </span>
<span id="cb115-21"><a href="LinuxGreatTools.html#cb115-21" tabindex="-1"></a><span class="ex">ID</span>  2_cell  4_cell  8_cell  embryo</span>
<span id="cb115-22"><a href="LinuxGreatTools.html#cb115-22" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb115-23"><a href="LinuxGreatTools.html#cb115-23" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb115-24"><a href="LinuxGreatTools.html#cb115-24" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb115-25"><a href="LinuxGreatTools.html#cb115-25" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span></code></pre></div>
<ul>
<li>获得逗号分隔的一组数</li>
</ul>
<div class="sourceCode" id="cb116"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb116-1"><a href="LinuxGreatTools.html#cb116-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> echo <span class="kw">`</span><span class="fu">seq</span> 1 10<span class="kw">`</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">&#39;s/ /,/g&#39;</span></span>
<span id="cb116-2"><a href="LinuxGreatTools.html#cb116-2" tabindex="-1"></a><span class="ex">1,2,3,4,5,6,7,8,9,10</span></span></code></pre></div>
<ul>
<li>针对指定行替换</li>
</ul>
<div class="sourceCode" id="cb117"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb117-1"><a href="LinuxGreatTools.html#cb117-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="st">&#39;2,$ s/_[0-9]//g&#39;</span> mat </span>
<span id="cb117-2"><a href="LinuxGreatTools.html#cb117-2" tabindex="-1"></a><span class="ex">ID</span>  2 cell  4 cell  8 cell  embryo</span>
<span id="cb117-3"><a href="LinuxGreatTools.html#cb117-3" tabindex="-1"></a><span class="ex">Pou5f1</span>  2   3   4   5</span>
<span id="cb117-4"><a href="LinuxGreatTools.html#cb117-4" tabindex="-1"></a><span class="ex">Nanog</span>   2   3.2 4.3 5</span>
<span id="cb117-5"><a href="LinuxGreatTools.html#cb117-5" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb117-6"><a href="LinuxGreatTools.html#cb117-6" tabindex="-1"></a><span class="ex">Tet1</span>    2   3   4   5</span></code></pre></div>
<ul>
<li>替换特定出现位置</li>
</ul>
<div class="sourceCode" id="cb118"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb118-1"><a href="LinuxGreatTools.html#cb118-1" tabindex="-1"></a><span class="co"># 替换第一个空格</span></span>
<span id="cb118-2"><a href="LinuxGreatTools.html#cb118-2" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="st">&#39;s/ /_/1&#39;</span> mat </span>
<span id="cb118-3"><a href="LinuxGreatTools.html#cb118-3" tabindex="-1"></a><span class="ex">ID</span>  2_cell  4 cell  8 cell  embryo</span>
<span id="cb118-4"><a href="LinuxGreatTools.html#cb118-4" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb118-5"><a href="LinuxGreatTools.html#cb118-5" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb118-6"><a href="LinuxGreatTools.html#cb118-6" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb118-7"><a href="LinuxGreatTools.html#cb118-7" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span>
<span id="cb118-8"><a href="LinuxGreatTools.html#cb118-8" tabindex="-1"></a><span class="co"># 替换第二个空格</span></span>
<span id="cb118-9"><a href="LinuxGreatTools.html#cb118-9" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="st">&#39;s/ /_/2&#39;</span> mat </span>
<span id="cb118-10"><a href="LinuxGreatTools.html#cb118-10" tabindex="-1"></a><span class="ex">ID</span>  2 cell  4_cell  8 cell  embryo</span>
<span id="cb118-11"><a href="LinuxGreatTools.html#cb118-11" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb118-12"><a href="LinuxGreatTools.html#cb118-12" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb118-13"><a href="LinuxGreatTools.html#cb118-13" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb118-14"><a href="LinuxGreatTools.html#cb118-14" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span>
<span id="cb118-15"><a href="LinuxGreatTools.html#cb118-15" tabindex="-1"></a><span class="co"># 替换第二个及以后的空格</span></span>
<span id="cb118-16"><a href="LinuxGreatTools.html#cb118-16" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="st">&#39;s/ /_/2g&#39;</span> mat </span>
<span id="cb118-17"><a href="LinuxGreatTools.html#cb118-17" tabindex="-1"></a><span class="ex">ID</span>  2 cell  4_cell  8_cell  embryo</span>
<span id="cb118-18"><a href="LinuxGreatTools.html#cb118-18" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb118-19"><a href="LinuxGreatTools.html#cb118-19" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb118-20"><a href="LinuxGreatTools.html#cb118-20" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb118-21"><a href="LinuxGreatTools.html#cb118-21" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span></code></pre></div>
<ul>
<li>给序列起名字</li>
</ul>
<div class="sourceCode" id="cb119"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb119-1"><a href="LinuxGreatTools.html#cb119-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat seq</span>
<span id="cb119-2"><a href="LinuxGreatTools.html#cb119-2" tabindex="-1"></a><span class="ex">ACDGTFGGCATGCDTGD</span></span>
<span id="cb119-3"><a href="LinuxGreatTools.html#cb119-3" tabindex="-1"></a><span class="ex">ACDGAGCDTAGCDGTA</span></span>
<span id="cb119-4"><a href="LinuxGreatTools.html#cb119-4" tabindex="-1"></a><span class="ex">CAGDTAGDCTADTG</span></span>
<span id="cb119-5"><a href="LinuxGreatTools.html#cb119-5" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed = seq</span>
<span id="cb119-6"><a href="LinuxGreatTools.html#cb119-6" tabindex="-1"></a><span class="ex">1</span></span>
<span id="cb119-7"><a href="LinuxGreatTools.html#cb119-7" tabindex="-1"></a><span class="ex">ACDGTFGGCATGCDTGD</span></span>
<span id="cb119-8"><a href="LinuxGreatTools.html#cb119-8" tabindex="-1"></a><span class="ex">2</span></span>
<span id="cb119-9"><a href="LinuxGreatTools.html#cb119-9" tabindex="-1"></a><span class="ex">ACDGAGCDTAGCDGTA</span></span>
<span id="cb119-10"><a href="LinuxGreatTools.html#cb119-10" tabindex="-1"></a><span class="ex">3</span></span>
<span id="cb119-11"><a href="LinuxGreatTools.html#cb119-11" tabindex="-1"></a><span class="ex">CAGDTAGDCTADTG</span></span>
<span id="cb119-12"><a href="LinuxGreatTools.html#cb119-12" tabindex="-1"></a><span class="co"># 同时缓冲两行，但只对第一行行首操作</span></span>
<span id="cb119-13"><a href="LinuxGreatTools.html#cb119-13" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed = seq <span class="kw">|</span> <span class="fu">sed</span> <span class="st">&#39;N;s/^/&gt;/;&#39;</span></span>
<span id="cb119-14"><a href="LinuxGreatTools.html#cb119-14" tabindex="-1"></a><span class="op">&gt;</span>1</span>
<span id="cb119-15"><a href="LinuxGreatTools.html#cb119-15" tabindex="-1"></a><span class="ex">ACDGTFGGCATGCDTGD</span></span>
<span id="cb119-16"><a href="LinuxGreatTools.html#cb119-16" tabindex="-1"></a><span class="op">&gt;</span>2</span>
<span id="cb119-17"><a href="LinuxGreatTools.html#cb119-17" tabindex="-1"></a><span class="ex">ACDGAGCDTAGCDGTA</span></span>
<span id="cb119-18"><a href="LinuxGreatTools.html#cb119-18" tabindex="-1"></a><span class="op">&gt;</span>3</span>
<span id="cb119-19"><a href="LinuxGreatTools.html#cb119-19" tabindex="-1"></a><span class="ex">CAGDTAGDCTADTG</span></span></code></pre></div>
<ul>
<li>给文件增加标题行</li>
</ul>
<div class="sourceCode" id="cb120"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb120-1"><a href="LinuxGreatTools.html#cb120-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> tail <span class="at">-n</span> +2 mat <span class="kw">|</span> <span class="fu">sort</span> <span class="at">-k2,2n</span></span>
<span id="cb120-2"><a href="LinuxGreatTools.html#cb120-2" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb120-3"><a href="LinuxGreatTools.html#cb120-3" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb120-4"><a href="LinuxGreatTools.html#cb120-4" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb120-5"><a href="LinuxGreatTools.html#cb120-5" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span>
<span id="cb120-6"><a href="LinuxGreatTools.html#cb120-6" tabindex="-1"></a></span>
<span id="cb120-7"><a href="LinuxGreatTools.html#cb120-7" tabindex="-1"></a><span class="co"># 1 表示第一行</span></span>
<span id="cb120-8"><a href="LinuxGreatTools.html#cb120-8" tabindex="-1"></a><span class="co"># i 表示插入，在指定行前面插入新行</span></span>
<span id="cb120-9"><a href="LinuxGreatTools.html#cb120-9" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> tail <span class="at">-n</span> +2 mat <span class="kw">|</span> <span class="fu">sort</span> <span class="at">-k2,2n</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">&#39;1 i ID\t2_cell\t4_cell\t8_cell\tembryo&#39;</span></span>
<span id="cb120-10"><a href="LinuxGreatTools.html#cb120-10" tabindex="-1"></a><span class="ex">ID</span>  2_cell  4_cell  8_cell  embryo</span>
<span id="cb120-11"><a href="LinuxGreatTools.html#cb120-11" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb120-12"><a href="LinuxGreatTools.html#cb120-12" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb120-13"><a href="LinuxGreatTools.html#cb120-13" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb120-14"><a href="LinuxGreatTools.html#cb120-14" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span></code></pre></div>
<ul>
<li>提取特定或指定范围的行</li>
</ul>
<div class="sourceCode" id="cb121"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb121-1"><a href="LinuxGreatTools.html#cb121-1" tabindex="-1"></a><span class="co"># -n是必须的，阻止程序自动输出匹配行，不然会导致重复输出</span></span>
<span id="cb121-2"><a href="LinuxGreatTools.html#cb121-2" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="at">-n</span> <span class="st">&#39;2,4p&#39;</span> mat</span>
<span id="cb121-3"><a href="LinuxGreatTools.html#cb121-3" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb121-4"><a href="LinuxGreatTools.html#cb121-4" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb121-5"><a href="LinuxGreatTools.html#cb121-5" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb121-6"><a href="LinuxGreatTools.html#cb121-6" tabindex="-1"></a></span>
<span id="cb121-7"><a href="LinuxGreatTools.html#cb121-7" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="at">-n</span> <span class="st">&#39;4p&#39;</span> mat</span>
<span id="cb121-8"><a href="LinuxGreatTools.html#cb121-8" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span></code></pre></div>
<ul>
<li><p>提取符合特定模式的行</p>
<p><code>/pattern/</code>支持普通字符串和正则表达式匹配</p></li>
</ul>
<div class="sourceCode" id="cb122"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb122-1"><a href="LinuxGreatTools.html#cb122-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="at">-n</span> <span class="st">&#39;/_/ p&#39;</span> mat</span>
<span id="cb122-2"><a href="LinuxGreatTools.html#cb122-2" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb122-3"><a href="LinuxGreatTools.html#cb122-3" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb122-4"><a href="LinuxGreatTools.html#cb122-4" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span>
<span id="cb122-5"><a href="LinuxGreatTools.html#cb122-5" tabindex="-1"></a></span>
<span id="cb122-6"><a href="LinuxGreatTools.html#cb122-6" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="at">-n</span> <span class="st">&#39;/-/ p&#39;</span> mat</span>
<span id="cb122-7"><a href="LinuxGreatTools.html#cb122-7" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span></code></pre></div>
<ul>
<li>去除文件中的空行</li>
</ul>
<div class="sourceCode" id="cb123"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb123-1"><a href="LinuxGreatTools.html#cb123-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat mat</span>
<span id="cb123-2"><a href="LinuxGreatTools.html#cb123-2" tabindex="-1"></a><span class="ex">ID</span>  2 cell  4 cell  8 cell  embryo</span>
<span id="cb123-3"><a href="LinuxGreatTools.html#cb123-3" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb123-4"><a href="LinuxGreatTools.html#cb123-4" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb123-5"><a href="LinuxGreatTools.html#cb123-5" tabindex="-1"></a></span>
<span id="cb123-6"><a href="LinuxGreatTools.html#cb123-6" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb123-7"><a href="LinuxGreatTools.html#cb123-7" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span>
<span id="cb123-8"><a href="LinuxGreatTools.html#cb123-8" tabindex="-1"></a></span>
<span id="cb123-9"><a href="LinuxGreatTools.html#cb123-9" tabindex="-1"></a></span>
<span id="cb123-10"><a href="LinuxGreatTools.html#cb123-10" tabindex="-1"></a><span class="co"># 空行就是只有行首和行尾的行</span></span>
<span id="cb123-11"><a href="LinuxGreatTools.html#cb123-11" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="st">&#39;/^$/d&#39;</span> mat </span>
<span id="cb123-12"><a href="LinuxGreatTools.html#cb123-12" tabindex="-1"></a><span class="ex">ID</span>  2 cell  4 cell  8 cell  embryo</span>
<span id="cb123-13"><a href="LinuxGreatTools.html#cb123-13" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb123-14"><a href="LinuxGreatTools.html#cb123-14" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb123-15"><a href="LinuxGreatTools.html#cb123-15" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb123-16"><a href="LinuxGreatTools.html#cb123-16" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span></code></pre></div>
<ul>
<li>原位删除</li>
</ul>
<div class="sourceCode" id="cb124"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb124-1"><a href="LinuxGreatTools.html#cb124-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat mat</span>
<span id="cb124-2"><a href="LinuxGreatTools.html#cb124-2" tabindex="-1"></a><span class="ex">ID</span>  2 cell  4 cell  8 cell  embryo</span>
<span id="cb124-3"><a href="LinuxGreatTools.html#cb124-3" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb124-4"><a href="LinuxGreatTools.html#cb124-4" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb124-5"><a href="LinuxGreatTools.html#cb124-5" tabindex="-1"></a></span>
<span id="cb124-6"><a href="LinuxGreatTools.html#cb124-6" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb124-7"><a href="LinuxGreatTools.html#cb124-7" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span>
<span id="cb124-8"><a href="LinuxGreatTools.html#cb124-8" tabindex="-1"></a></span>
<span id="cb124-9"><a href="LinuxGreatTools.html#cb124-9" tabindex="-1"></a><span class="co"># -i 参数的使用</span></span>
<span id="cb124-10"><a href="LinuxGreatTools.html#cb124-10" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="at">-i</span> <span class="st">&#39;/^$/d&#39;</span> mat </span>
<span id="cb124-11"><a href="LinuxGreatTools.html#cb124-11" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat mat</span>
<span id="cb124-12"><a href="LinuxGreatTools.html#cb124-12" tabindex="-1"></a><span class="ex">ID</span>  2 cell  4 cell  8 cell  embryo</span>
<span id="cb124-13"><a href="LinuxGreatTools.html#cb124-13" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb124-14"><a href="LinuxGreatTools.html#cb124-14" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb124-15"><a href="LinuxGreatTools.html#cb124-15" tabindex="-1"></a><span class="ex">c-Myc</span>   2   3   4   5</span>
<span id="cb124-16"><a href="LinuxGreatTools.html#cb124-16" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span></code></pre></div>
<ul>
<li>删除指定范围的行</li>
</ul>
<div class="sourceCode" id="cb125"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb125-1"><a href="LinuxGreatTools.html#cb125-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat mat</span>
<span id="cb125-2"><a href="LinuxGreatTools.html#cb125-2" tabindex="-1"></a><span class="ex">ID</span>  2 cell  4 cell  8 cell  embryo</span>
<span id="cb125-3"><a href="LinuxGreatTools.html#cb125-3" tabindex="-1"></a><span class="ex">Pou5f1_1</span>    2   3   4   5</span>
<span id="cb125-4"><a href="LinuxGreatTools.html#cb125-4" tabindex="-1"></a><span class="ex">Nanog_1</span> 2   3.2 4.3 5</span>
<span id="cb125-5"><a href="LinuxGreatTools.html#cb125-5" tabindex="-1"></a><span class="ex">c-Myc_2</span> 2   3   4   5</span>
<span id="cb125-6"><a href="LinuxGreatTools.html#cb125-6" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span>
<span id="cb125-7"><a href="LinuxGreatTools.html#cb125-7" tabindex="-1"></a></span>
<span id="cb125-8"><a href="LinuxGreatTools.html#cb125-8" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="st">&#39;2,3d&#39;</span> mat</span>
<span id="cb125-9"><a href="LinuxGreatTools.html#cb125-9" tabindex="-1"></a><span class="ex">ID</span>  2 cell  4 cell  8 cell  embryo</span>
<span id="cb125-10"><a href="LinuxGreatTools.html#cb125-10" tabindex="-1"></a><span class="ex">c-Myc_2</span> 2   3   4   5</span>
<span id="cb125-11"><a href="LinuxGreatTools.html#cb125-11" tabindex="-1"></a><span class="ex">Tet1_3</span>  2   3   4   5</span></code></pre></div>
<ul>
<li>记忆匹配</li>
</ul>
<p><code>\(\)</code>启动记忆匹配；<code>\1</code>为第一个匹配项，<code>\2</code>为第二个匹配项；匹配项的计数根据左括号出现的位置来定，第一个<code>(</code>包括起来的为<code>\1</code>。</p>
<div class="sourceCode" id="cb126"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb126-1"><a href="LinuxGreatTools.html#cb126-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> echo <span class="st">&quot;hah ysx hah&quot;</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">&#39;s/ \(.*\) /\t\1\t\1\t/&#39;</span></span>
<span id="cb126-2"><a href="LinuxGreatTools.html#cb126-2" tabindex="-1"></a><span class="ex">hah</span> ysx ysx hah</span></code></pre></div>
<ul>
<li>奇偶数行处理</li>
</ul>
<div class="sourceCode" id="cb127"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb127-1"><a href="LinuxGreatTools.html#cb127-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> echo <span class="at">-e</span> <span class="st">&quot;odd\neven\nodd\neven&quot;</span></span>
<span id="cb127-2"><a href="LinuxGreatTools.html#cb127-2" tabindex="-1"></a><span class="ex">odd</span></span>
<span id="cb127-3"><a href="LinuxGreatTools.html#cb127-3" tabindex="-1"></a><span class="ex">even</span></span>
<span id="cb127-4"><a href="LinuxGreatTools.html#cb127-4" tabindex="-1"></a><span class="ex">odd</span></span>
<span id="cb127-5"><a href="LinuxGreatTools.html#cb127-5" tabindex="-1"></a><span class="ex">even</span></span>
<span id="cb127-6"><a href="LinuxGreatTools.html#cb127-6" tabindex="-1"></a></span>
<span id="cb127-7"><a href="LinuxGreatTools.html#cb127-7" tabindex="-1"></a><span class="co"># 奇偶数行合并</span></span>
<span id="cb127-8"><a href="LinuxGreatTools.html#cb127-8" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> echo <span class="at">-e</span> <span class="st">&quot;odd\neven\nodd\neven&quot;</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">&#39;N;s/\n/\t/&#39;</span></span>
<span id="cb127-9"><a href="LinuxGreatTools.html#cb127-9" tabindex="-1"></a><span class="ex">odd</span> even</span>
<span id="cb127-10"><a href="LinuxGreatTools.html#cb127-10" tabindex="-1"></a><span class="ex">odd</span> even</span>
<span id="cb127-11"><a href="LinuxGreatTools.html#cb127-11" tabindex="-1"></a></span>
<span id="cb127-12"><a href="LinuxGreatTools.html#cb127-12" tabindex="-1"></a><span class="co"># 取出偶数行，比较简单</span></span>
<span id="cb127-13"><a href="LinuxGreatTools.html#cb127-13" tabindex="-1"></a><span class="co"># 注意 n (小写)撇掉了奇数行</span></span>
<span id="cb127-14"><a href="LinuxGreatTools.html#cb127-14" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> echo <span class="at">-e</span> <span class="st">&quot;odd\neven\nodd\neven&quot;</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="at">-n</span> <span class="st">&#39;n;p&#39;</span></span>
<span id="cb127-15"><a href="LinuxGreatTools.html#cb127-15" tabindex="-1"></a><span class="ex">even</span></span>
<span id="cb127-16"><a href="LinuxGreatTools.html#cb127-16" tabindex="-1"></a><span class="ex">even</span></span>
<span id="cb127-17"><a href="LinuxGreatTools.html#cb127-17" tabindex="-1"></a></span>
<span id="cb127-18"><a href="LinuxGreatTools.html#cb127-18" tabindex="-1"></a><span class="co"># 取出奇数行</span></span>
<span id="cb127-19"><a href="LinuxGreatTools.html#cb127-19" tabindex="-1"></a><span class="co"># 先都读进去，然后替换偶数行为空值，再输出</span></span>
<span id="cb127-20"><a href="LinuxGreatTools.html#cb127-20" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> echo <span class="at">-e</span> <span class="st">&quot;odd\neven\nodd\neven&quot;</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="at">-n</span> <span class="st">&#39;N;s/\n.*//;p&#39;</span></span>
<span id="cb127-21"><a href="LinuxGreatTools.html#cb127-21" tabindex="-1"></a><span class="ex">odd</span></span>
<span id="cb127-22"><a href="LinuxGreatTools.html#cb127-22" tabindex="-1"></a><span class="ex">odd</span></span></code></pre></div>
<ul>
<li>Windows/Linux换行符困境</li>
</ul>
<p>Windows下的换行符是<code>\r\n</code>, Linux下换行符是<code>\n</code>, MAC下换行符是<code>\r</code>。所以Windows下的文件拷贝到Linux后，常会出现行尾多一个<code>^M</code>符号的情况，从而引起匹配或其它解析问题。</p>
<p><code>^M</code>的输是 <code>ctrl+v+M</code> <code>ctrl+v;ctrl+m</code>，不是简单的输入<code>^</code>,再输入<code>M</code>。</p>
<div class="sourceCode" id="cb128"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb128-1"><a href="LinuxGreatTools.html#cb128-1" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> cat <span class="at">-A</span> windows.txt </span>
<span id="cb128-2"><a href="LinuxGreatTools.html#cb128-2" tabindex="-1"></a><span class="ex">ID^M$</span></span>
<span id="cb128-3"><a href="LinuxGreatTools.html#cb128-3" tabindex="-1"></a><span class="ex">A^M$</span></span>
<span id="cb128-4"><a href="LinuxGreatTools.html#cb128-4" tabindex="-1"></a><span class="ex">B^M$</span></span>
<span id="cb128-5"><a href="LinuxGreatTools.html#cb128-5" tabindex="-1"></a><span class="ex">C^M$</span></span>
<span id="cb128-6"><a href="LinuxGreatTools.html#cb128-6" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> sed <span class="st">&#39;s/^M//&#39;</span> windows.txt <span class="kw">|</span> <span class="fu">cat</span> <span class="at">-A</span></span>
<span id="cb128-7"><a href="LinuxGreatTools.html#cb128-7" tabindex="-1"></a><span class="ex">ID$</span></span>
<span id="cb128-8"><a href="LinuxGreatTools.html#cb128-8" tabindex="-1"></a><span class="ex">A$</span></span>
<span id="cb128-9"><a href="LinuxGreatTools.html#cb128-9" tabindex="-1"></a><span class="ex">B$</span></span>
<span id="cb128-10"><a href="LinuxGreatTools.html#cb128-10" tabindex="-1"></a><span class="ex">C$</span></span></code></pre></div>
<ul>
<li>sed中使用bash变量</li>
</ul>
<div class="sourceCode" id="cb129"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb129-1"><a href="LinuxGreatTools.html#cb129-1" tabindex="-1"></a><span class="co"># 注意双引号的使用</span></span>
<span id="cb129-2"><a href="LinuxGreatTools.html#cb129-2" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> bash_variable=<span class="st">&#39;ysx&#39;</span></span>
<span id="cb129-3"><a href="LinuxGreatTools.html#cb129-3" tabindex="-1"></a><span class="ex">ct@ysx:~/sxbd$</span> echo <span class="st">&quot;sheng xin bao dan &quot;</span> <span class="kw">|</span> <span class="fu">sed</span> <span class="st">&quot;s/$/</span><span class="va">$bash_variable</span><span class="st">/&quot;</span></span>
<span id="cb129-4"><a href="LinuxGreatTools.html#cb129-4" tabindex="-1"></a><span class="ex">sheng</span> xin bao dan ysx</span></code></pre></div>
</div>
</div>
<div id="vim" class="section level2 hasAnchor" number="3.4">
<h2><span class="header-section-number">3.4</span> VIM的使用<a href="LinuxGreatTools.html#vim" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p><code>VIM</code>是一款功能强大的文本编辑工具，也是我在<code>Linux</code>，<code>Windows</code>下编辑程序和文本最常用的工具。</p>
<div id="vim_first" class="section level3 hasAnchor" number="3.4.1">
<h3><span class="header-section-number">3.4.1</span> 初识VIM<a href="LinuxGreatTools.html#vim_first" class="anchor-section" aria-label="Anchor link to header"></a></h3>
<p>VIM分多种状态模式，<code>写入</code>模式，<code>正常</code>模式，<code>可视化</code>模式。</p>
<ul>
<li><code>正常</code>模式：打开或新建文件默认在<code>正常</code>模式，可以浏览，但不可以写入内容。这个模式也可以称作<code>命令行</code>模式，这个模式下可以使用VIM强大的命令行和快捷键功能。其它模式下按<code>ESC</code>就可以到<code>正常</code>模式。</li>
<li><code>写入</code>模式：在<code>正常</code>模式下按字母<code>i</code> (光标前插入), <code>o</code> (当前光标的下一行操作), <code>O</code> (当前光标的上一行操作)，<code>a</code> (光标后插入)都可以进入<code>写入</code>模式，就可以输入内容了。</li>
<li><code>可视化</code>模式：通常用于选择特定的内容。</li>
</ul>
<p>进入<code>写入</code>模式后，VIM使用起来可以跟<code>记事本</code>一样了。在写入文字时，可以利用组合键<code>CTRL+n</code>和<code>CTRL+p</code>完成写作单词的自动匹配补全，从而加快输入速度，保证输入的前后一致。</p>
<p><code>正常</code>模式有更强大的快捷键编辑功能，把手从鼠标上解放出来。</p>
<ul>
<li><p><code>dd</code>: 删除一行</p></li>
<li><p><code>3dd</code>: 删除一行</p></li>
<li><p><code>dw</code>: 删除一个单词</p></li>
<li><p><code>d3w</code>: 删除3个单词</p></li>
<li><p><code>yy</code>: 复制一行</p></li>
<li><p><code>3yy</code>: 复制三行</p></li>
<li><p><code>yw</code>: 复制一个单词</p></li>
<li><p><code>p</code>: (小写p)粘贴到下一行</p></li>
<li><p><code>P</code>: (大写P)粘贴到上一行</p></li>
<li><p><code>&gt;&gt;</code>: 当前行右缩进一个TAB</p></li>
<li><p><code>3&gt;&gt;</code>: 当前行及后2行都向右缩进一个TAB</p></li>
<li><p><code>&lt;&lt;</code>: 当前行左缩进一个TAB</p></li>
<li><p><code>3&lt;&lt;</code>: 当前行及后2行都向左缩进一个TAB</p></li>
<li><p><code>/word</code>: 查找特定单词</p></li>
<li><p><code>u</code>: 撤销上一次操作</p></li>
<li><p><code>.</code>: 重复上一次操作</p></li>
<li><p><code>CTRL+r</code>: 重做撤销的操作</p></li>
<li><p><code>y$</code>: 从当前复制到行尾</p></li>
<li><p><code>d$</code>: 从当前删除到行尾</p></li>
</ul>
<p>跳转操作</p>
<ul>
<li><code>gg</code>: 跳到文件开头</li>
<li><code>G</code>: 跳到文件结尾</li>
<li><code>zt</code>: 当前行作为可视屏幕的第一行</li>
<li><code>5G</code>: 跳到第5行</li>
</ul>
<p><code>正常</code>模式下输入<code>冒号</code>进入更强大的命令行定制功能。</p>
<ul>
<li><p><code>:5d</code>: 删除第5行</p></li>
<li><p><code>:20,24y</code>：复制20到24行</p></li>
<li><p><code>:.,+3y</code>：复制当前行和下面3行</p></li>
<li><p><code>:2,11&gt;</code>: 右缩进</p></li>
<li><p><code>:w</code>: 保存文件</p></li>
<li><p><code>:q</code>: 退出编辑器</p></li>
<li><p><code>:vsplit</code>: 分屏</p></li>
</ul>
<p>键盘操作不容易被捕获，看右下角可以得到一点信息。动图请<a href="//blog.genesino.com/images/vim/vim_basic_operation.gif">点击查看</a>。</p>
<p><img src="http://blog.genesino.com/images/vim/vim_basic_operation.gif" width="100%" style="display: block; margin: auto;" /></p>
<p>VIM还有不少<strong>魔性</strong>操作，具体可以看这两个帖子：</p>
<ul>
<li><a href="http://coolshell.cn/articles/5426.html">http://coolshell.cn/articles/5426.html</a></li>
<li><a href="http://coolshell.cn/articles/11312.html">http://coolshell.cn/articles/11312.html</a></li>
</ul>
</div>
<div id="vim_re" class="section level3 hasAnchor" number="3.4.2">
<h3><span class="header-section-number">3.4.2</span> VIM中使用正则表达式<a href="LinuxGreatTools.html#vim_re" class="anchor-section" aria-label="Anchor link to header"></a></h3>
<p>这儿以提取生信宝典公众号中发过的原创文章的HTML代码为例子，获得原创文章的名字和链接，用以制作文章列表。</p>
<p>部分数据如下所示，利用正则表达式的第一步就是找规律。</p>
<ul>
<li>这段文字是JSON格式，列表和字典的组合，使用<code>json</code>函数可以很容易解析。但我们这通过正则表达式解析。</li>
<li><code>title</code>后面跟随的文章的题目; <code>url</code>后面跟随的是文章的链接。</li>
<li><code>{"</code>和<code>"}</code>标记每篇文章的信息的开始和结束。</li>
<li><code>auth_apply_num</code>是目前不关注的信息。</li>
</ul>
<p><img src="http://blog.genesino.com/images/vim/wechatSXBD_source.png" width="100%" style="display: block; margin: auto;" /></p>
<p>下面的<a href="http://blog.genesino.com/images/vim/vim_bregexpr.gif">动画</a>展示了如何通过正则表达式，把这段文字只保留题目和链接，并转成<code>Markdown</code>的格式。</p>
<p><img src="http://blog.genesino.com/images/vim/vim_bregexpr.gif" width="100%" style="display: block; margin: auto;" /></p>
<ul>
<li><code>:set wrap</code>: 折行显示</li>
<li><code>:s/"}, {"/\r/g</code>: <code>:</code>开启命令行模式；<code>s</code>: 是替换，之前讲Linux命令时也多次提及；<code>/</code>作为分割符，三个一起出现，前两个<code>/</code>中的内容为被替换内容，后两个<code>/</code>中的内容为替换成的内容；这里没有使用正则表达式，直接是原字符的替换，<code>\r</code>表示换行符。这样把每篇文章的信息单行显示，方便后续处理。</li>
<li><code>:%s/auth_apply.*"title":"/[/</code>：<code>%</code>表示对所有行进行操作；被替换的内容是<code>auth_apply</code>和<code>title":"</code>及其之间的内容(<code>.*</code>表示，<code>.</code>表示任意字符，<code>*</code>表示其前面的字符出现任意次)</li>
<li><code>:%s/".*"url":"/](/</code>：从题目到url之间的内容替换掉；第一次替换时忘记了第一行中开头还有引号，结果出现了误操作，后面又退回去，手动删除特殊部分，其它部分继续匹配。</li>
<li><code>:%s/$/)/</code>：表示在行尾(<code>$</code>)加上<code>)</code>, 就组成了Markdown中完整的链接形式<code>[context](link)</code>。</li>
<li><code>:%s/^/* /</code>：表示在行首(<code>^</code>)加上<code>*</code>变成Markdown格式的列表</li>
</ul>
<p>至此就完成了生信宝典公众号文章到Markdown链接的转换，可以放到菜单栏<code>文章集锦</code>里面方便快速查询了。</p>
<p>一步步的处理也有些麻烦，有没有办法更简单些呢？ 动画可查看<a href="http://blog.genesino.com/images/vim/vim_bregexpr_record.gif">链接</a>。</p>
<p><img src="http://blog.genesino.com/images/vim/vim_bregexpr_record.gif" width="100%" style="display: block; margin: auto;" /></p>
<ul>
<li>首先也是把每篇文章的信息处理为单行显示，一样的模式更容易操作，去掉第一行行首不一致的部分</li>
<li>使用上下箭头可以回溯之前的命令，类似于Linux终端下的操作</li>
<li><code>%s/.*title":"\([^"]*\).*url":"\(.*\)/* [\1](\2)/c</code>: 这个是记忆匹配，记录下匹配的内容用于替换，<code>\(</code>和<code>\)</code>表示记忆匹配的开始和结束，自身不匹配任何字符，只做标记使用；从左只右, 第一个<code>\(</code>中的内容记录为<code>\1</code>, 第二个<code>\(</code>中的内容记录为<code>\2</code>,以此类推。尤其在存在括号嵌套的情况下，注意匹配位置，左括号出现的顺序为准。在匹配文章题目时使用了<code>[^"]*</code>而不是<code>.*</code>，是考虑到正则表达式的匹配是贪婪的，会囊括更多的内容进来，就有可能出现非预期情况，所以做这么个限定，匹配所有非<code>"</code>内容。</li>
</ul>
<p>正则表达式在数据分析中有很多灵活的应用，可以解决复杂的字符串抽提工作。常用的程序语言或命令如<code>pytho</code>, <code>R</code>, <code>grep</code>, <code>awk</code>, <code>sed</code>都支持正则表达式操作，语法也大体相似。进一步学习可参考一下链接：</p>
<ul>
<li>VIM正则表达式 <a href="http://blog.csdn.net/u014015972/article/details/50688837">http://blog.csdn.net/u014015972/article/details/50688837</a></li>
<li>Pyton正则表达式 <a href="https://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html">https://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html</a></li>
</ul>
</div>
</div>
<div id="rename_all" class="section level2 hasAnchor" number="3.5">
<h2><span class="header-section-number">3.5</span> 有了这些，文件批量重命名还需要求助其它工具吗？<a href="LinuxGreatTools.html#rename_all" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<div id="rename_simple" class="section level3 hasAnchor" number="3.5.1">
<h3><span class="header-section-number">3.5.1</span> 简单重命名<a href="LinuxGreatTools.html#rename_simple" class="anchor-section" aria-label="Anchor link to header"></a></h3>
<p>Linux下文件重命名可以通过两个命令完成，<code>mv</code>和<code>rename</code>。</p>
<ul>
<li><code>mv</code>: 直接运行可以进行单个文件的重命名，如 <code>mv old_name.txt new_name.txt</code></li>
<li><code>rename</code>: 默认支持单个文件或有固定规律的一组文件的批量重命名，示例如下：</li>
</ul>
<div id="rename_simple1" class="section level4 hasAnchor" number="3.5.1.1">
<h4><span class="header-section-number">3.5.1.1</span> rename演示<a href="LinuxGreatTools.html#rename_simple1" class="anchor-section" aria-label="Anchor link to header"></a></h4>
<p>使用<code>touch</code>新建文件，两个样品（分别是易生信a，易生信b），各自双端测序的FASTQ文件</p>
<pre><code>ysx@ysx:~/test$ touch YSX_a_1.fq.gz YSX_a_2.fq.gz YSX_b_2.fq.gz YSX_b_1.fq.gz
ysx@ysx:~/test$ ls
YSX_a_1.fq.gz  YSX_a_2.fq.gz  YSX_b_1.fq.gz  YSX_b_2.fq.gz</code></pre>
<p>把文件名中的 易生信(<code>YSX</code>)改为易汉博 (<code>ysx</code>)</p>
<pre><code># rename &#39;被替换文字&#39; &#39;要替换成的文字&#39; 操作对象
ysx@ysx:~/test$ rename &#39;YSX&#39; &#39;ysx&#39; *.gz
ysx@ysx:~/test$ ls
ysx_a_1.fq.gz  ysx_a_2.fq.gz  ysx_b_1.fq.gz  ysx_b_2.fq.gz</code></pre>
<p>不同操作系统，<code>rename</code>的使用方法略有不同。印象中:</p>
<ul>
<li><p>在CentOS都是上面的语法 <code>rename old new file_list</code></p></li>
<li><p>在Ubuntu都是下面的语法 <code>rename s/old/new/ file_list</code></p></li>
</ul>
<pre><code># 在Centos下，该命令未起作用
ysx@ysx:~/test$ rename &#39;s/ysx_//&#39; *
ysx@ysx:~/test$ ls
ysx_a_1.fq.gz  ysx_a_2.fq.gz  ysx_b_1.fq.gz  ysx_b_2.fq.gz

# 如果写的rename命令没发挥作用，使用man rename查看写看其具体使用方法, 个人经验，无外乎上面提到的两种用法。
ysx@ysx:~/test$ man rename

# NAME
#        rename - rename files
# 
# SYNOPSIS
#        rename [options] expression replacement file...</code></pre>
<p>替换后缀</p>
<pre><code># 替换后缀
ysx@ysx:~/test$ rename &#39;fq&#39; &#39;fastq&#39; *.gz
ysx@ysx:~/test$ ls
ysx_a_1.fastq.gz  ysx_a_2.fastq.gz  ysx_b_1.fastq.gz  ysx_b_2.fastq.gz</code></pre>
</div>
</div>
<div id="rename_complex" class="section level3 hasAnchor" number="3.5.2">
<h3><span class="header-section-number">3.5.2</span> 复杂重命名<a href="LinuxGreatTools.html#rename_complex" class="anchor-section" aria-label="Anchor link to header"></a></h3>
<p>但有时，需要重命名的文件不像上面那样有很清晰的模式，直接可以替换，需要多几步处理获得对应关系。</p>
<div id="rename_for_known_relation" class="section level4 hasAnchor" number="3.5.2.1">
<h4><span class="header-section-number">3.5.2.1</span> 假如已经有对应关系<a href="LinuxGreatTools.html#rename_for_known_relation" class="anchor-section" aria-label="Anchor link to header"></a></h4>
<p>如下<code>name.map.txt</code>是自己手动编写的文件，<code>a</code>对应<code>Control</code>, <code>b</code>对应<code>Treatment</code>。</p>
<pre><code>ysx@ysx:~/test$ ls
name.map.txt ysx_a_1.fastq.gz  ysx_a_2.fastq.gz  ysx_b_1.fastq.gz  ysx_b_2.fastq.gz

ysx@ysx:~/test$ cat name.map.txt
a   Control
b   Treatment</code></pre>
<div id="rename_combine_name" class="section level5 hasAnchor" number="3.5.2.1.1">
<h5><span class="header-section-number">3.5.2.1.1</span> 组合文件名，使用mv重命名<a href="LinuxGreatTools.html#rename_combine_name" class="anchor-section" aria-label="Anchor link to header"></a></h5>
<p>首先组合出原名字和最终名字</p>
<pre><code>ysx@ysx:~/test$ awk &#39;{print &quot;ysx_&quot;$1&quot;_1.fastq.gz&quot;, &quot;ysx_&quot;$2&quot;_1.fastq.gz&quot;, &quot;ysx_&quot;$1&quot;_2.fastq.gz&quot;,  &quot;ysx_&quot;$2&quot;_2.fastq.gz&quot;}&#39; name.map.txt
ysx_a_1.fastq.gz ysx_Control_1.fastq.gz ysx_a_2.fastq.gz ysx_Control_2.fastq.gz
ysx_b_1.fastq.gz ysx_Treatment_1.fastq.gz ysx_b_2.fastq.gz ysx_Treatment_2.fastq.gz</code></pre>
<p>加上<code>mv</code></p>
<pre><code>ysx@ysx:~/test$ awk &#39;{print &quot;mv ysx_&quot;$1&quot;_1.fastq.gz ysx_&quot;$2&quot;_1.fastq.gz&quot;; print &quot;mv ysx_&quot;$1&quot;_2.fastq.gz ysx_&quot;$2&quot;_2.fastq.gz&quot;;}&#39; name.map.txt
mv ysx_a_1.fastq.gz ysx_Control_1.fastq.gz
mv ysx_a_2.fastq.gz ysx_Control_2.fastq.gz
mv ysx_b_1.fastq.gz ysx_Treatment_1.fastq.gz
mv ysx_b_2.fastq.gz ysx_Treatment_2.fastq.gz</code></pre>
<p>可以直接拷贝上面的输出再粘贴运行，或存储为文件运行</p>
<pre><code>ysx@ysx:~/test$ awk &#39;{print &quot;mv ysx_&quot;$1&quot;_1.fastq.gz ysx_&quot;$2&quot;_1.fastq.gz&quot;; print &quot;mv ysx_&quot;$1&quot;_2.fastq.gz ysx_&quot;$2&quot;_2.fastq.gz&quot;;}&#39; name.map.txt &gt;rename.sh
ysx@ysx:~/test$ #bash rename.sh</code></pre>
<p>也可以把<code>print</code>改为<code>system</code>直接运行</p>
<pre><code>ysx@ysx:~/test$ ls
ysx_a_1.fastq.gz  ysx_a_2.fastq.gz  ysx_b_1.fastq.gz  ysx_b_2.fastq.gz  name.map.txt  rename.sh
ysx@ysx:~/test$ awk &#39;{system(&quot;mv ysx_&quot;$1&quot;_1.fastq.gz ysx_&quot;$2&quot;_1.fastq.gz&quot;); system(&quot;mv ysx_&quot;$1&quot;_2.fastq.gz ysx_&quot;$2&quot;_2.fastq.gz&quot;);}&#39; name.map.txt
ysx@ysx:~/test$ ls
ysx_Control_1.fastq.gz  ysx_Control_2.fastq.gz  ysx_Treatment_1.fastq.gz  ysx_Treatment_2.fastq.gz  name.map.txt  rename.sh</code></pre>
</div>
<div id="rename_for_complex_style" class="section level5 hasAnchor" number="3.5.2.1.2">
<h5><span class="header-section-number">3.5.2.1.2</span> 使用rename会不会稍微简单一点？<a href="LinuxGreatTools.html#rename_for_complex_style" class="anchor-section" aria-label="Anchor link to header"></a></h5>
<p>一定注意符号匹配和避免误匹配。</p>
<pre><code># 注意引号和空格
ysx@ysx:~/test$ awk &#39;{print(&quot;rename &quot;$1&quot; &quot;$2&quot; *.fastq.gz&quot;); }&#39; name.map.txt
rename a Control *.fastq.gz
rename b Treatment *.fastq.gz

# 上面的命令有什么问题吗？
# fastq中也存在a，是否也会被替换
# ysx中也存在b，是否也会倍替换

ysx@ysx:~/test$ awk &#39;{system(&quot;rename &quot;$1&quot; &quot;$2&quot; *.fastq.gz&quot;); }&#39; name.map.txt

# 执行后，文件名都乱套了
ysx@ysx:~/test$ ls
ysx_b_1.fControlstq.gz  ysx_b_2.fControlstq.gz  ehTreatmentio_Control_1.fastq.gz  ehTreatmentio_Control_2.fastq.gz  name.map.txt  rename.sh

# 再重命名回去，再次尝试
ysx@ysx:~/test$ rename &#39;Control&#39; &#39;a&#39; *
ysx@ysx:~/test$ rename &#39;Treatment&#39; &#39;b&#39; *
ysx@ysx:~/test$ ls
ysx_a_1.fastq.gz  ysx_a_2.fastq.gz  ysx_b_1.fastq.gz  ysx_b_2.fastq.gz  name.map.txt  rename.sh

# 重命名两侧加下划线, 这也是我们做匹配时常需要注意的，尽量限制让匹配更准确
ysx@ysx:~/test$ awk &#39;{system(&quot;rename _&quot;$1&quot;_ _&quot;$2&quot;_ *.fastq.gz&quot;); }&#39; name.map.txt

# 打印出来看下
ysx@ysx:~/test$ awk &#39;{print(&quot;rename _&quot;$1&quot;_ _&quot;$2&quot;_ *.fastq.gz&quot;); }&#39; name.map.txt
# rename _a_ _Control_ *.fastq.gz
# rename _b_ _Treatment_ *.fastq.gz

# 这次没问题了
ysx@ysx:~/test$ ls
ysx_Control_1.fastq.gz  ysx_Control_2.fastq.gz  ysx_Treatment_1.fastq.gz  ysx_Treatment_2.fastq.gz  name.map.txt  rename.sh</code></pre>
</div>
</div>
<div id="rename_relation_from_old_name" class="section level4 hasAnchor" number="3.5.2.2">
<h4><span class="header-section-number">3.5.2.2</span> 从原文件名获取对应关系<a href="LinuxGreatTools.html#rename_relation_from_old_name" class="anchor-section" aria-label="Anchor link to header"></a></h4>
<div id="rename_paste" class="section level5 hasAnchor" number="3.5.2.2.1">
<h5><span class="header-section-number">3.5.2.2.1</span> 基于paste<a href="LinuxGreatTools.html#rename_paste" class="anchor-section" aria-label="Anchor link to header"></a></h5>
<p>像上面自己写好对应文件是一个方法，有时也可以从文件名推测规律，生成对应文件。</p>
<p>如下有一堆测序原始数据，选择A组样品来查看:</p>
<pre><code># 如下有一堆测序原始数据，选择A组样品来查看
ysx@ysx:~/test2# ls A*

A1_FRAS192317015-1a_1.fq.gz  A2_FRAS192320421-1a_1.fq.gz  A3_FRAS192317017-1a_1.fq.gz
A1_FRAS192317015-1a_2.fq.gz  A2_FRAS192320421-1a_2.fq.gz  A3_FRAS192317017-1a_2.fq.gz</code></pre>
<p>中间的那一串字符<code>FRA...-</code>是我们不需要的。</p>
<p>观察规律，按下划线分割(<code>_</code>)，获取第<code>1,3</code>个元素；另外习惯性给生物重复前面也加上下划线（用到了<code>sed</code>的记忆匹配）。</p>
<pre><code>ysx@ysx:~/test2# ls A*.gz | cut -f 1,3 -d &#39;_&#39; | sed &#39;s/\([A-E]\)/\1_/&#39;
A_1_1.fq.gz
A_1_2.fq.gz
A_2_1.fq.gz
A_2_2.fq.gz</code></pre>
<p>把原样品名字与新样品名字对应起来，这里用到了<code>paste</code>和输入重定向 (<code>&lt;</code>):</p>
<pre><code>ysx@ysx:~/test2# paste &lt;(ls A*.gz) &lt;(ls A*.gz | cut -f 1,3 -d &#39;_&#39; | sed &#39;s/\([A-E]\)/\1_/&#39;)
A1_FRAS192317015-1a_1.fq.gz A_1_1_fq.gz
A1_FRAS192317015-1a_2.fq.gz A_1_2_fq.gz
A2_FRAS192320421-1a_1.fq.gz A_2_1_fq.gz
A2_FRAS192320421-1a_2.fq.gz A_2_2_fq.gz
A3_FRAS192317017-1a_1.fq.gz A_3_1_fq.gz
A3_FRAS192317017-1a_2.fq.gz A_3_2_fq.gz</code></pre>
<p>使用<code>mv</code>直接重命名 （还可以把这个脚本保存下来，保留原始名字和新名字的对应关系，万一操作错了，在看到结果异常时也可以方便回溯）</p>
<pre><code>ysx@ysx:~/test2# paste &lt;(ls A*.gz) &lt;(ls A*.gz | cut -f 1,3 -d &#39;_&#39; | sed &#39;s/\([A-E]\)/\1_/&#39;) | sed &#39;s#^#/bin/mv #&#39;
/bin/mv A1_FRAS192317015-1a_1.fq.gz A_1_1_fq.gz
/bin/mv A1_FRAS192317015-1a_2.fq.gz A_1_2_fq.gz
/bin/mv A2_FRAS192320421-1a_1.fq.gz A_2_1_fq.gz
/bin/mv A2_FRAS192320421-1a_2.fq.gz A_2_2_fq.gz
/bin/mv A3_FRAS192317017-1a_1.fq.gz A_3_1_fq.gz
/bin/mv A3_FRAS192317017-1a_2.fq.gz A_3_2_fq.gz</code></pre>
<p>软链接也是常用的 (但一定注意源文件使用全路径)</p>
<pre><code>ysx@ysx:~/test2# paste &lt;(ls *.gz) &lt;(ls *.gz | sed &#39;s/\./_/&#39; | cut -f 1,3,4 -d &#39;_&#39; | sed &#39;s/\([A-E]\)/analysis\/\1_/&#39;) | sed &#39;s#^#ln -s `pwd`/#&#39;
ln -s `pwd`/A1_FRAS192317015-1a_1.fq.gz analysis/A_1_1_fq.gz
ln -s `pwd`/A1_FRAS192317015-1a_2.fq.gz analysis/A_1_2_fq.gz
ln -s `pwd`/A2_FRAS192320421-1a_1.fq.gz analysis/A_2_1_fq.gz
.
.
.
ln -s `pwd`/E15_FRAS192317028-1a_1.fq.gz    analysis/E_15_1_fq.gz
ln -s `pwd`/E15_FRAS192317028-1a_2.fq.gz    analysis/E_15_2_fq.gz</code></pre>
</div>
<div id="基于awk-rename_awk" class="section level5 hasAnchor" number="3.5.2.2.2">
<h5><span class="header-section-number">3.5.2.2.2</span> 基于awk {rename_awk}<a href="LinuxGreatTools.html#%E5%9F%BA%E4%BA%8Eawk-rename_awk" class="anchor-section" aria-label="Anchor link to header"></a></h5>
<p>转换下输入数据的格式，字符处理在<code>awk</code>也可以操作，但我更习惯使用命令组合，每一步都用最简单的操作，不容易出错。</p>
<pre><code>ysx@ysx:~/test2# ls A*.gz | sed -e &#39;s/\([A-E]\)/\1_/&#39;
A_1_FRAS192317015-1a_1.fq.gz
A_1_FRAS192317015-1a_2.fq.gz
A_2_FRAS192320421-1a_1.fq.gz
A_2_FRAS192320421-1a_2.fq.gz
A_3_FRAS192317017-1a_1.fq.gz
A_3_FRAS192317017-1a_2.fq.gz
ysx@ysx:~/test2# ls A*.gz | sed -e &#39;s/\([A-E]\)/\1_/&#39; -e &#39;s/\./_./&#39;
A_1_FRAS192317015-1a_1_.fq.gz
A_1_FRAS192317015-1a_2_.fq.gz
A_2_FRAS192320421-1a_1_.fq.gz
A_2_FRAS192320421-1a_2_.fq.gz
A_3_FRAS192317017-1a_1_.fq.gz
A_3_FRAS192317017-1a_2_.fq.gz</code></pre>
<p>采用<code>awk</code>生成对应关系</p>
<pre><code># 生成样品重复，计数出错了，每行记了一个数，而实际两行是一个样本。
ysx@ysx:~/test2# ls A*.gz | sed -e &#39;s/\([A-E]\)/\1_/&#39; -e &#39;s/\./_./&#39; | awk &#39;BEGIN{OFS=&quot; &quot;;FS=&quot;_&quot;}{sum[$1]+=1; print $0, $1&quot;_&quot;sum[$1]&quot;_&quot;$4$5;}&#39;
A_1_FRAS192317015-1a_1_.fq.gz A_1_1.fq.gz
A_1_FRAS192317015-1a_2_.fq.gz A_2_2.fq.gz
A_2_FRAS192320421-1a_1_.fq.gz A_3_1.fq.gz
A_2_FRAS192320421-1a_2_.fq.gz A_4_2.fq.gz
A_3_FRAS192317017-1a_1_.fq.gz A_5_1.fq.gz
A_3_FRAS192317017-1a_2_.fq.gz A_6_2.fq.gz</code></pre>
<pre><code># 稍微改进下
ysx@ysx:~/test2# ls A*.gz | sed -e &#39;s/\([A-E]\)/\1_/&#39; -e &#39;s/\./_./&#39; | awk &#39;BEGIN{OFS=&quot; &quot;;FS=&quot;_&quot;}{sum[$1]+=1; print $0, $1&quot;_&quot;sum[$1]&quot;_&quot;$4$5;}&#39;
A_1_FRAS192317015-1a_1.fq.gz A_1_1.fq.gz
A_1_FRAS192317015-1a_2.fq.gz A_2_2.fq.gz
A_2_FRAS192320421-1a_1.fq.gz A_3_1.fq.gz
A_2_FRAS192320421-1a_2.fq.gz A_4_2.fq.gz
A_3_FRAS192317017-1a_1.fq.gz A_5_1.fq.gz
A_3_FRAS192317017-1a_2.fq.gz A_6_2.fq.gz

# 记得源文件名字的替换
ysx@ysx:~/test2# ls A*.gz | sed -e &#39;s/\([A-E]\)/\1_/&#39; -e &#39;s/\./_./&#39; | awk &#39;BEGIN{OFS=&quot; &quot;;FS=&quot;_&quot;}{sum[$1]+=1; print $0, $1&quot;_&quot;sum[$1]&quot;_&quot;$4$5;}&#39; | sed -e &#39;s/_//&#39; -e &#39;s/_\././&#39; -e &#39;s#^#ln -s `pwd`/#&#39; |head
ln -s `pwd`/A1_FRAS192317015-1a_1.fq.gz A_1_1.fq.gz
ln -s `pwd`/A1_FRAS192317015-1a_2.fq.gz A_2_2.fq.gz</code></pre>
<p>好了，重命名就到这了。有了这个思路，关键是如何根据自己的文件名字特征，构造对应的匹配关系。</p>
<p>另外，Window下使用<code>Git for windows</code>应该也可以实现对应的操作。</p>
</div>
</div>
</div>
</div>
<div id="nohup" class="section level2 hasAnchor" number="3.6">
<h2><span class="header-section-number">3.6</span> 耗时很长的程序忘加nohup就运行了怎么办？<a href="LinuxGreatTools.html#nohup" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p>在<a href="https://mp.weixin.qq.com/s/6oJYGxuBE850PyjMhRi3xg">NGS基础：测序原始数据下载</a>一文中提到可以使用<code>SRA-toolkit</code>中的命令<code>fastq-dump</code>从NCBI下载原始测序数据，命令如下。</p>
<pre><code>nohup fastq-dump -v --split-3 --gzip SRR5908360 &amp;
nohup fastq-dump -v --split-3 --gzip SRR5908361 &amp;</code></pre>
<p>这个代码，给我们4个提示：</p>
<ol style="list-style-type: decimal">
<li><code>fastq-dump</code>不只可以转换下载好的<code>sra</code>文件为<code>fastq</code>文件，还可以顺带下载<code>sra</code>文件。只需提供<code>SRR</code>号，就可以获得<code>FASTQ</code>序列。不需要先调用<code>prefetch</code>下载，然后再转换。其它参数解释见引用文章。</li>
<li>每一行命令后面<code>&amp;</code>号表示把命令放入后台运行，当前终端可以继续输入其它命令；此处也相当于实现了一个手动并行下载多样本，配合<code>for</code>可以自动并行下载。</li>
<li><code>nohup</code>表示让程序在终端因人为原因或网络原因断开后不挂断，适用于运行时间比较长的命令，一般与<code>&amp;</code>连用，形式如<code>nohup 你的命令 &amp;</code> (注意空格的存在)。如果程序运行输出错误信息，则会写入当前目录下<code>nohup.out</code>文件里面，供后续查看和调试。</li>
<li>经常会有一些培训班“拿来主义”比较严重，以上推文和生信宝典的其它推文都被发现过直接用于某些培训班的教材，但从未申请过授权，也未引用过出处。更有甚者，盗版易生信早期培训教案和视频，用于自己的课程或在全网发布，希望大家多多举报。</li>
</ol>
<p>言归正传，通常我们运行程序前，会有个预判，如前面那个例子，运行时间比较长，会使用<code>nohup 我的命令 &amp;</code>的形式进行运行，从而保证程序不受网络或终端异常退出的影响。</p>
<p>但有时也会有误判，如没想到某个程序运行了半个小时还没结束，或数据传输时网太慢，需要传输很久，这时怎么办？中止程序，然后加上<code>nohup</code>再从头运行？还是有更好的办法？</p>
<p>下面看这个例子：马上要去吃午饭了，把文件同步到另一个服务器，饭后回来继续操作：</p>
<pre><code>ysx@ysx:~/test/Bigwig$ rsync -av * ysx@46.93.19.14:/tmp
ysx@46.93.19.14&#39;s password: 
sending incremental file list
test1Y_DK10.bw</code></pre>
<p>输入密码后，发现同步速度太慢了，<code>1</code>分钟只同步了<code>1</code>个文件，后面还有<code>99</code>个文件，待会离开后，如果网断了，终端退出，程序终止怎么办？同步不能完成，饭后怎么愉快的工作？</p>
<p>还好我们有下面的方案，一步步跟着操作，补救一下。</p>
<p>第一步，按<code>ctrl+z</code>把程序挂起，操作后屏幕会出现如下提示(<code>[1]</code>中的<code>1</code>表示命令的作业号，后面会用到)：</p>
<pre><code>^Z
[1]+  已停止               rsync -av * ysx@46.93.19.14:/tmp</code></pre>
<p>第二步（可选），用<code>jobs</code>命令查看下任务状态，跟刚才的屏幕提示一致，程序被暂时终止，作业号还是<code>1</code>：</p>
<pre><code>ysx@ysx:~/test/Bigwig$ jobs
[1]+  已停止               rsync -av * ysx@46.93.19.14:/tmp</code></pre>
<p>第三步，使用<code>bg %1</code>命令把作业号为<code>1</code>的任务放入后台，并从<strong>停止</strong>状态变为<strong>运行</strong>状态，相当于加了<code>&amp;</code>后接着运行。再用<code>jobs</code>查看，任务状态变成了<code>运行中</code>，这一步很关键。如果没有运行<code>bg %1</code>则程序处于停止状态，一直不会运行，吃几顿饭都不会运行。</p>
<pre><code>ysx@ysx:~/test/Bigwig$ bg %1
[1]+ rsync -av * ysx@46.93.19.14:/tmp &amp;
ysx@ysx:~/test/Bigwig$ jobs
[1]+  运行中               rsync -av * ysx@46.93.19.14:/tmp &amp;</code></pre>
<p>第四步，运行<code>disown -h %1</code>，表示在终端关闭时不对作业号为<code>1</code>的程序发送终止信号，外部因素将不影响程序的运行。通过<code>ps</code>命令查看下任务进程 (可选)。</p>
<pre><code>ysx@ysx:~/test/Bigwig$ disown -h %1
ysx@ysx:~/test/Bigwig$ ps -auwx | grep &#39;rsync&#39;
ysx       18214  0.0  0.0 117844  1720 ?        S    09:43   0:01 rsync -av *.bw ysx@46.93.19.14:/tmp
ysx       18215  0.1  0.0 182376  8360 ?        S    09:43   0:04 ssh -l ysx 46.93.19.14 rsync --server -vlogDtpre.iLsfxC . /tmp
ysx       18340  0.0  0.0 112724   984 pts/1    S+   10:17   0:00 grep --color=auto rsync</code></pre>
<p>通过以上4步就完成了对这次操作的事后补救。以后遇到同类问题，试一试这个新方案吧！</p>
<p>同时还有5点提示：</p>
<ol style="list-style-type: decimal">
<li>例子中使用的是<code>rsync</code>同步，从节省时间来看，不是一个很好的例子。因为把命令停掉再运行一次时，已经同步完整的数据不会再同步，时间损失不会太大。这也是使用同步命令<code>rsync</code>相比于<code>scp</code>的一个好处。更多同步方式见(<a href="https://mp.weixin.qq.com/s/c2cspK5b4sQScWYMBtG63g">Linux服务器数据定期同步和备份方式</a>。</li>
<li>例子中的<code>rsync</code>或其它涉及两个服务器交互的命令，都需要我们人为输入登录密码，因此直接加<code>nohup  &amp;</code>运行是行不通的，无法接受密码的输入。因此通过上面这个操作先在前台启动运行、输入密码，再放入后台不挂断运行。从这个角度看，是一个不错的例子。当然解决这个问题也有其它方式，具体见<a href="https://mp.weixin.qq.com/s/wTM8J9zVEdl1PcGpJQbeEw">ssh免密码登录远程服务器</a>。</li>
<li>如果程序运行时，已加了<code>&amp;</code>号，放入后台了，则只需运行<code>jobs</code>获得作业号，再运行<code>disown</code>不挂断即可。</li>
<li>程序作业号不一定都是<code>1</code>，如果之前就有程序在后台运行，作业号相应的会自加。后面用到作业号时也需要相应修改，不要刻板总用<code>1</code>。</li>
<li><code>nohup</code>和<code>disown</code>都可以使程序不挂断，可以获得一样的效果，但原理不太一致。<code>nohup</code>可以使程序忽略挂断信号(<code>SIGHUP</code>)或者使程序脱离终端的控制，从而终端不能再对其发送挂断信号(<code>SIGHUP</code>)；<code>disown</code>则是内生于<code>shell</code>，告诉<code>shell</code>在终止时不对对应程序发送挂断信号(<code>SIGHUP</code>)。</li>
</ol>
</div>
<div id="references-2" class="section level2 hasAnchor" number="3.7">
<h2><span class="header-section-number">3.7</span> References<a href="LinuxGreatTools.html#references-2" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<ul>
<li><a href="www.bic.ac.cn/Training">www.bic.ac.cn/Training</a></li>
<li><a href="http://mp.weixin.qq.com/s/8wD14FXt7fLDo1BjJyT0ew">Linux学习 - 常用和不太常用的实用awk命令</a></li>
<li><a href="http://mp.weixin.qq.com/s/hEYU80fPf1eD5OWL3fO4Bg">Linux-总目录</a></li>
<li><a href="http://mp.weixin.qq.com/s/yKP1Kboji9N4p2Sl1Ovj0Q">Linux-文件和目录</a></li>
<li><a href="http://mp.weixin.qq.com/s/4bYMzJclf_xHpqdrlbvAdA">Linux-文件操作</a></li>
<li><a href="http://mp.weixin.qq.com/s/QFgINAYcQA9kYYSA28wK-Q">Linux文件内容操作</a></li>
<li><a href="http://mp.weixin.qq.com/s/poFpNHQgHDr0qr2wqfVNdw">Linux-环境变量和可执行属性</a></li>
<li><a href="http://mp.weixin.qq.com/s/zL9Mw_2ig48gHrIjKM0CMw">Linux - 管道、标准输入输出</a></li>
<li><a href="http://mp.weixin.qq.com/s/TNU7X2mhfVVffaJ7NRBuNA">Linux - 命令运行监测和软件安装</a></li>
<li><a href="http://mp.weixin.qq.com/s/cDIN4_R4nETEB5irmIGFAQ">Linux-常见错误和快捷操作</a></li>
<li><a href="http://mp.weixin.qq.com/s/1QaroFE7AH1pREuq-k2YAw">Linux-文件列太多，很难识别想要的信息在哪列；别焦急，看这里。</a></li>
<li><a href="http://mp.weixin.qq.com/s/R1OHRhZoDJuAdyVdJr2xHg">Linux-文件排序和FASTA文件操作</a></li>
<li><a href="http://mp.weixin.qq.com/s/HLHiWMLaWtB7SOJe_jP3mA">Linux-应用Docker安装软件</a></li>
<li><a href="http://mp.weixin.qq.com/s/c2cspK5b4sQScWYMBtG63g">Linux服务器数据定期同步和备份方式</a></li>
<li><a href="https://mp.weixin.qq.com/s/4lUiZ60-aXLilRk9--iQhA">VIM的强大文本处理方法</a></li>
<li><a href="http://mp.weixin.qq.com/s/A4_j8ZbyprMr1TT_wgisQQ">Linux - Conda软件安装方法</a></li>
<li><a href="http://mp.weixin.qq.com/s/xq0JfkHJJeHQk1acjOAJUQ">查看服务器配置信息</a></li>
<li><a href="http://mp.weixin.qq.com/s/cywkIeRbhkYTZvkwTeIVSA">Linux - SED操作，awk的姊妹篇</a></li>
<li><a href="http://mp.weixin.qq.com/s/8wD14FXt7fLDo1BjJyT0ew">Linux - 常用和不太常用的实用awk命令</a></li>
<li><a href="http://mp.weixin.qq.com/s/lWNp_6W_jLiogmtlk9nO2A">Bash概论 - Linux系列教程补充篇</a></li>
<li><a href="http://mp.weixin.qq.com/s/OEBJU3BiQdQOeN_tD2o7sA">CIRCOS圈图绘制 - circos安装</a></li>
<li><a href="http://mp.weixin.qq.com/s/2E1Y5-cEdptkQGVm0bxKbQ">CIRCOS圈图绘制 - 最简单绘图和解释</a></li>
<li><a href="https://mp.weixin.qq.com/s/o_3DyYdSubWCh5FfoVKBOg">CIRCOS圈图绘制 - 染色体信息展示和调整</a></li>
<li><a href="http://mp.weixin.qq.com/s/6L8wmsy0eOxtiAEs3hYgCA">CIRCOS增加热图、点图、线图和区块属性</a></li>
<li><a href="https://mp.weixin.qq.com/s/hyiGxm0jx6xEc90nHLN4dQ">有了这些，文件批量重命名还需要求助其它工具吗？</a></li>
<li><a href="https://mp.weixin.qq.com/s/kt_e-DCq7xBfh9tTCJinZQ">耗时很长的程序忘加nohup就运行了怎么办？</a></li>
</ul>

</div>
</div>
            </section>

          </div>
        </div>
      </div>
<a href="softinstall.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="bash_string.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
    </div>
  </div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/clipboard.min.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script>
<script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-clipboard.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
  "sharing": {
    "github": false,
    "facebook": false,
    "twitter": false,
    "linkedin": false,
    "weibo": false,
    "instapaper": false,
    "vk": false,
    "whatsapp": false,
    "all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"]
  },
  "fontsettings": {
    "theme": "white",
    "family": "sans",
    "size": 2
  },
  "edit": {
    "link": null,
    "text": null
  },
  "history": {
    "link": null,
    "text": null
  },
  "view": {
    "link": null,
    "text": null
  },
  "download": ["Bash.pdf"],
  "search": {
    "engine": "fuse",
    "options": null
  },
  "toc": {
    "collapse": "subsection"
  }
});
});
</script>

</body>

</html>
